title: difference between mutex_init and DEFINE_MUTEX
body: <p>I am using mutex lock in my kernel code. In linux/mutex.h, I came across following:</p>
  
  <pre><code>#define DEFINE_MUTEX(mutexname) \
           struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
  
   extern void __mutex_init(struct mutex *lock, const char *name,
                            struct lock_class_key *key);
  </code></pre>
  
  <p>What is the difference between two when they both seem to initialize mutex for use or are they completely different and I misunderstood? In my code, I just used <code>DEFINE_MUTEX</code> and started using it straight away, never bothered to use <code>__mutex_init</code>. How to check if the lock the way I used is correctly implemented? <code>MUTEX_INITIALIZER</code> is defined as:</p>
  
  <pre><code>#define __MUTEX_INITIALIZER(lockname) \
                   { .count = ATOMIC_INIT(1) \
                   , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \
                   , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \
                   __DEBUG_MUTEX_INITIALIZER(lockname) \
                   __DEP_MAP_MUTEX_INITIALIZER(lockname) }
  </code></pre>
  
  <p>Do we necessarily need to have them both in order to mutex work properly? Thanks.</p>