From: Thomas Gleixner <tglx@linutronix.de>

First part of the patch series. Define initializer macros

Often used structures in the kernel are almost all declared and
initialized by macros in the form: 

DEFINE_TYPE(name)

Spinlocks and rwlocks are declared and initialized by:
type name = INITIALIZER;

After converting the runtime initialization of spinlocks/rwlocks to
macro form it is consequent to change the declaration and initializion
of global and static locks to the macro form too. This conversion
identifies those variables as "special", common code controlled
entities similar to list_heads, mutexes... Besides consistency and code
clearness this also helps automatic lock validators and debugging code.

The patch converts
-rwlock_t snd_card_rwlock = RW_LOCK_UNLOCKED;
+DEFINE_RWLOCK(snd_card_rwlock);
and
-static spinlock_t slave_active_lock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(slave_active_lock);

There is no runtime overhead or actual code change resulting out of this
patch, other than a small reduction in the kernel source code size.

The conversion was done with a script, it was verified manually and it
was reviewed, compiled and tested as far as possible on x86, ARM, PPC.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/include/linux/spinlock.h |    3 +++
 1 files changed, 3 insertions(+)

diff -puN include/linux/spinlock.h~lock-initializer-cleanup-common-headers include/linux/spinlock.h
--- 25/include/linux/spinlock.h~lock-initializer-cleanup-common-headers	2004-11-15 20:02:29.067136696 -0800
+++ 25-akpm/include/linux/spinlock.h	2004-11-15 20:02:29.071136088 -0800
@@ -593,4 +593,7 @@ static inline int bit_spin_is_locked(int
 #endif
 }
 
+#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
+#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
+
 #endif /* __LINUX_SPINLOCK_H */
_