
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/acpi/ec.c               |    4 ++--
 25-akpm/drivers/message/fusion/mptlan.c |    4 ++--
 25-akpm/drivers/misc/ibmasm/module.c    |    2 +-
 25-akpm/drivers/parport/share.c         |    2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff -puN drivers/acpi/ec.c~lock-initializer-unifying-batch-2-misc-drivers drivers/acpi/ec.c
--- 25/drivers/acpi/ec.c~lock-initializer-unifying-batch-2-misc-drivers	2004-12-03 20:57:12.932672736 -0800
+++ 25-akpm/drivers/acpi/ec.c	2004-12-03 20:57:12.940671520 -0800
@@ -599,7 +599,7 @@ acpi_ec_add (
 
 	ec->handle = device->handle;
 	ec->uid = -1;
-	ec->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&ec->lock);
 	strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 	acpi_driver_data(device) = ec;
@@ -813,7 +813,7 @@ acpi_ec_ecdt_probe (void)
 	ec_ecdt->status_addr = ecdt_ptr->ec_control;
 	ec_ecdt->data_addr = ecdt_ptr->ec_data;
 	ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit;
-	ec_ecdt->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&ec_ecdt->lock);
 	/* use the GL just to be safe */
 	ec_ecdt->global_lock = TRUE;
 	ec_ecdt->uid = ecdt_ptr->uid;
diff -puN drivers/message/fusion/mptlan.c~lock-initializer-unifying-batch-2-misc-drivers drivers/message/fusion/mptlan.c
--- 25/drivers/message/fusion/mptlan.c~lock-initializer-unifying-batch-2-misc-drivers	2004-12-03 20:57:12.933672584 -0800
+++ 25-akpm/drivers/message/fusion/mptlan.c	2004-12-03 20:57:12.941671368 -0800
@@ -1401,8 +1401,8 @@ mpt_register_lan_device (MPT_ADAPTER *mp
 			priv->max_buckets_out));
 
 	priv->bucketthresh = priv->max_buckets_out * 2 / 3;
-	priv->txfidx_lock = SPIN_LOCK_UNLOCKED;
-	priv->rxfidx_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&priv->txfidx_lock);
+	spin_lock_init(&priv->rxfidx_lock);
 
 	memset(&priv->stats, 0, sizeof(priv->stats));
 
diff -puN drivers/misc/ibmasm/module.c~lock-initializer-unifying-batch-2-misc-drivers drivers/misc/ibmasm/module.c
--- 25/drivers/misc/ibmasm/module.c~lock-initializer-unifying-batch-2-misc-drivers	2004-12-03 20:57:12.935672280 -0800
+++ 25-akpm/drivers/misc/ibmasm/module.c	2004-12-03 20:57:12.942671216 -0800
@@ -107,7 +107,7 @@ static int __init ibmasm_init_one(struct
 		goto error_remote_queue;
 	}
 
-	sp->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&sp->lock);
 	INIT_LIST_HEAD(&sp->command_queue);
 
 	result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp);
diff -puN drivers/parport/share.c~lock-initializer-unifying-batch-2-misc-drivers drivers/parport/share.c
--- 25/drivers/parport/share.c~lock-initializer-unifying-batch-2-misc-drivers	2004-12-03 20:57:12.936672128 -0800
+++ 25-akpm/drivers/parport/share.c	2004-12-03 20:57:12.943671064 -0800
@@ -306,7 +306,7 @@ struct parport *parport_register_port(un
 	tmp->ops = ops;
 	tmp->physport = tmp;
 	memset (tmp->probe_info, 0, 5 * sizeof (struct parport_device_info));
-	tmp->cad_lock = RW_LOCK_UNLOCKED;
+	rwlock_init(&tmp->cad_lock);
 	spin_lock_init(&tmp->waitlist_lock);
 	spin_lock_init(&tmp->pardevice_lock);
 	tmp->ieee1284.mode = IEEE1284_MODE_COMPAT;
_
