
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/md/kcopyd.c    |    2 +-
 25-akpm/drivers/md/multipath.c |    2 +-
 25-akpm/drivers/md/raid1.c     |    4 ++--
 25-akpm/drivers/md/raid10.c    |    4 ++--
 25-akpm/drivers/md/raid5.c     |    4 ++--
 25-akpm/drivers/md/raid6main.c |    4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)

diff -puN drivers/md/kcopyd.c~lock-initializer-unifying-batch-2-raid drivers/md/kcopyd.c
--- 25/drivers/md/kcopyd.c~lock-initializer-unifying-batch-2-raid	2004-11-03 20:26:35.376250688 -0800
+++ 25-akpm/drivers/md/kcopyd.c	2004-11-03 20:26:35.387249016 -0800
@@ -649,7 +649,7 @@ int kcopyd_client_create(unsigned int nr
 		return -ENOMEM;
 	}
 
-	kc->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&kc->lock);
 	kc->pages = NULL;
 	kc->nr_pages = kc->nr_free_pages = 0;
 	r = client_alloc_pages(kc, nr_pages);
diff -puN drivers/md/multipath.c~lock-initializer-unifying-batch-2-raid drivers/md/multipath.c
--- 25/drivers/md/multipath.c~lock-initializer-unifying-batch-2-raid	2004-11-03 20:26:35.378250384 -0800
+++ 25-akpm/drivers/md/multipath.c	2004-11-03 20:26:35.388248864 -0800
@@ -510,7 +510,7 @@ static int multipath_run (mddev_t *mddev
 	conf->raid_disks = mddev->raid_disks;
 	mddev->sb_dirty = 1;
 	conf->mddev = mddev;
-	conf->device_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->device_lock);
 	INIT_LIST_HEAD(&conf->retry_list);
 
 	if (!conf->working_disks) {
diff -puN drivers/md/raid10.c~lock-initializer-unifying-batch-2-raid drivers/md/raid10.c
--- 25/drivers/md/raid10.c~lock-initializer-unifying-batch-2-raid	2004-11-03 20:26:35.379250232 -0800
+++ 25-akpm/drivers/md/raid10.c	2004-11-03 20:26:35.390248560 -0800
@@ -1667,10 +1667,10 @@ static int run(mddev_t *mddev)
 	}
 	conf->raid_disks = mddev->raid_disks;
 	conf->mddev = mddev;
-	conf->device_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->device_lock);
 	INIT_LIST_HEAD(&conf->retry_list);
 
-	conf->resync_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->resync_lock);
 	init_waitqueue_head(&conf->wait_idle);
 	init_waitqueue_head(&conf->wait_resume);
 
diff -puN drivers/md/raid1.c~lock-initializer-unifying-batch-2-raid drivers/md/raid1.c
--- 25/drivers/md/raid1.c~lock-initializer-unifying-batch-2-raid	2004-11-03 20:26:35.381249928 -0800
+++ 25-akpm/drivers/md/raid1.c	2004-11-03 20:26:35.391248408 -0800
@@ -1210,12 +1210,12 @@ static int run(mddev_t *mddev)
 	}
 	conf->raid_disks = mddev->raid_disks;
 	conf->mddev = mddev;
-	conf->device_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->device_lock);
 	INIT_LIST_HEAD(&conf->retry_list);
 	if (conf->working_disks == 1)
 		mddev->recovery_cp = MaxSector;
 
-	conf->resync_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->resync_lock);
 	init_waitqueue_head(&conf->wait_idle);
 	init_waitqueue_head(&conf->wait_resume);
 
diff -puN drivers/md/raid5.c~lock-initializer-unifying-batch-2-raid drivers/md/raid5.c
--- 25/drivers/md/raid5.c~lock-initializer-unifying-batch-2-raid	2004-11-03 20:26:35.382249776 -0800
+++ 25-akpm/drivers/md/raid5.c	2004-11-03 20:26:35.393248104 -0800
@@ -302,7 +302,7 @@ static int grow_stripes(raid5_conf_t *co
 			return 1;
 		memset(sh, 0, sizeof(*sh) + (devs-1)*sizeof(struct r5dev));
 		sh->raid_conf = conf;
-		sh->lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&sh->lock);
 
 		if (grow_buffers(sh, conf->raid_disks)) {
 			shrink_buffers(sh, conf->raid_disks);
@@ -1566,7 +1566,7 @@ static int run (mddev_t *mddev)
 		goto abort;
 	memset(conf->stripe_hashtbl, 0, HASH_PAGES * PAGE_SIZE);
 
-	conf->device_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->device_lock);
 	init_waitqueue_head(&conf->wait_for_stripe);
 	INIT_LIST_HEAD(&conf->handle_list);
 	INIT_LIST_HEAD(&conf->delayed_list);
diff -puN drivers/md/raid6main.c~lock-initializer-unifying-batch-2-raid drivers/md/raid6main.c
--- 25/drivers/md/raid6main.c~lock-initializer-unifying-batch-2-raid	2004-11-03 20:26:35.384249472 -0800
+++ 25-akpm/drivers/md/raid6main.c	2004-11-03 20:26:35.395247800 -0800
@@ -321,7 +321,7 @@ static int grow_stripes(raid6_conf_t *co
 			return 1;
 		memset(sh, 0, sizeof(*sh) + (devs-1)*sizeof(struct r5dev));
 		sh->raid_conf = conf;
-		sh->lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&sh->lock);
 
 		if (grow_buffers(sh, conf->raid_disks)) {
 			shrink_buffers(sh, conf->raid_disks);
@@ -1730,7 +1730,7 @@ static int run (mddev_t *mddev)
 		goto abort;
 	memset(conf->stripe_hashtbl, 0, HASH_PAGES * PAGE_SIZE);
 
-	conf->device_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&conf->device_lock);
 	init_waitqueue_head(&conf->wait_for_stripe);
 	INIT_LIST_HEAD(&conf->handle_list);
 	INIT_LIST_HEAD(&conf->delayed_list);
_
