From: <tglx@linutronix.de>

To make spinlock/rwlock initialization consistent all over the kernel,
this patch converts explicit lock-initializers into spin_lock_init() and
rwlock_init() calls.

Currently, spinlocks and rwlocks are initialized in two different ways:

  lock = SPIN_LOCK_UNLOCKED
  spin_lock_init(&lock)
  
  rwlock = RW_LOCK_UNLOCKED
  rwlock_init(&rwlock)

this patch converts all explicit lock initializations to
spin_lock_init() or rwlock_init(). (Besides consistency this also helps
automatic lock validators and debugging code.)

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.

There is no runtime overhead or actual code change resulting out of this
patch, because spin_lock_init() and rwlock_init() are macros and are
thus equivalent to the explicit initialization method.

That's the second batch of the unifying patches.

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/drivers/char/hvc_console.c |    2 +-
 25-akpm/drivers/char/hvcs.c        |    2 +-
 25-akpm/drivers/char/hvsi.c        |    2 +-
 25-akpm/drivers/char/random.c      |    2 +-
 25-akpm/drivers/char/sonypi.c      |    4 ++--
 5 files changed, 6 insertions(+), 6 deletions(-)

diff -puN drivers/char/hvc_console.c~lock-initializer-unifying-batch-2-character-devices drivers/char/hvc_console.c
--- 25/drivers/char/hvc_console.c~lock-initializer-unifying-batch-2-character-devices	2004-11-30 01:24:20.427540264 -0800
+++ 25-akpm/drivers/char/hvc_console.c	2004-11-30 01:24:20.437538744 -0800
@@ -629,7 +629,7 @@ static int __devinit hvc_probe(
 	kobject_init(&hp->kobj);
 	hp->kobj.ktype = &hvc_kobj_type;
 
-	hp->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&hp->lock);
 	spin_lock(&hvc_structs_lock);
 	hp->index = ++hvc_count;
 	list_add_tail(&(hp->next), &hvc_structs);
diff -puN drivers/char/hvcs.c~lock-initializer-unifying-batch-2-character-devices drivers/char/hvcs.c
--- 25/drivers/char/hvcs.c~lock-initializer-unifying-batch-2-character-devices	2004-11-30 01:24:20.428540112 -0800
+++ 25-akpm/drivers/char/hvcs.c	2004-11-30 01:24:20.439538440 -0800
@@ -631,7 +631,7 @@ static int __devinit hvcs_probe(
 	/* hvcsd->tty is zeroed out with the memset */
 	memset(hvcsd, 0x00, sizeof(*hvcsd));
 
-	hvcsd->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&hvcsd->lock);
 	/* Automatically incs the refcount the first time */
 	kobject_init(&hvcsd->kobj);
 	/* Set up the callback for terminating the hvcs_struct's life */
diff -puN drivers/char/hvsi.c~lock-initializer-unifying-batch-2-character-devices drivers/char/hvsi.c
--- 25/drivers/char/hvsi.c~lock-initializer-unifying-batch-2-character-devices	2004-11-30 01:24:20.430539808 -0800
+++ 25-akpm/drivers/char/hvsi.c	2004-11-30 01:24:20.440538288 -0800
@@ -1331,7 +1331,7 @@ static int __init hvsi_console_init(void
 		INIT_WORK(&hp->handshaker, hvsi_handshaker, hp);
 		init_waitqueue_head(&hp->emptyq);
 		init_waitqueue_head(&hp->stateq);
-		hp->lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&hp->lock);
 		hp->index = hvsi_count;
 		hp->inbuf_end = hp->inbuf;
 		hp->state = HVSI_CLOSED;
diff -puN drivers/char/random.c~lock-initializer-unifying-batch-2-character-devices drivers/char/random.c
--- 25/drivers/char/random.c~lock-initializer-unifying-batch-2-character-devices	2004-11-30 01:24:20.432539504 -0800
+++ 25-akpm/drivers/char/random.c	2004-11-30 01:24:20.442537984 -0800
@@ -540,7 +540,7 @@ static int create_entropy_store(int size
 		return -ENOMEM;
 	}
 	memset(r->pool, 0, POOLBYTES);
-	r->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&r->lock);
 	r->name = name;
 	*ret_bucket = r;
 	return 0;
diff -puN drivers/char/sonypi.c~lock-initializer-unifying-batch-2-character-devices drivers/char/sonypi.c
--- 25/drivers/char/sonypi.c~lock-initializer-unifying-batch-2-character-devices	2004-11-30 01:24:20.434539200 -0800
+++ 25-akpm/drivers/char/sonypi.c	2004-11-30 01:24:20.443537832 -0800
@@ -739,7 +739,7 @@ static int __devinit sonypi_probe(void)
 	sonypi_device.model = pcidev ?
 		SONYPI_DEVICE_MODEL_TYPE1 : SONYPI_DEVICE_MODEL_TYPE2;
 
-	sonypi_device.fifo_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&sonypi_device.fifo_lock);
 	sonypi_device.fifo = kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
 					 &sonypi_device.fifo_lock);
 	if (IS_ERR(sonypi_device.fifo)) {
@@ -852,7 +852,7 @@ static int __devinit sonypi_probe(void)
 		printk(KERN_INFO "%s input method installed.\n",
 		       sonypi_device.input_key_dev.name);
 
-		sonypi_device.input_fifo_lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&sonypi_device.input_fifo_lock);
 		sonypi_device.input_fifo =
 			kfifo_alloc(SONYPI_BUF_SIZE, GFP_KERNEL,
 				    &sonypi_device.input_fifo_lock);
_