
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/media/common/saa7146_core.c        |    4 ++--
 25-akpm/drivers/media/dvb/b2c2/skystar2.c          |    2 +-
 25-akpm/drivers/media/dvb/ttusb-dec/ttusb_dec.c    |    4 ++--
 25-akpm/drivers/media/video/bttv-driver.c          |    4 ++--
 25-akpm/drivers/media/video/cx88/cx88-mpeg.c       |    2 +-
 25-akpm/drivers/media/video/cx88/cx88-video.c      |    2 +-
 25-akpm/drivers/media/video/meye.c                 |    4 ++--
 25-akpm/drivers/media/video/saa7134/saa7134-core.c |    2 +-
 25-akpm/drivers/media/video/zr36120.c              |    2 +-
 drivers/media/dvb/ttpci/av7110.c                   |    0 
 10 files changed, 13 insertions(+), 13 deletions(-)

diff -puN drivers/media/common/saa7146_core.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/common/saa7146_core.c
--- 25/drivers/media/common/saa7146_core.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.912396344 -0800
+++ 25-akpm/drivers/media/common/saa7146_core.c	2004-12-10 15:37:09.929393760 -0800
@@ -426,8 +426,8 @@ static int saa7146_init_one(struct pci_d
 	pci_set_drvdata(pci,dev);
 
         init_MUTEX(&dev->lock);
-	dev->int_slock = SPIN_LOCK_UNLOCKED;
-	dev->slock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dev->int_slock);
+	spin_lock_init(&dev->slock);
 
 	init_MUTEX(&dev->i2c_lock);
 
diff -puN drivers/media/dvb/b2c2/skystar2.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/dvb/b2c2/skystar2.c
--- 25/drivers/media/dvb/b2c2/skystar2.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.913396192 -0800
+++ 25-akpm/drivers/media/dvb/b2c2/skystar2.c	2004-12-10 15:37:09.931393456 -0800
@@ -1979,7 +1979,7 @@ static int driver_initialize(struct pci_
 		ctrl_enable_mac(adapter, 1);
 	}
 
-	adapter->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&adapter->lock);
 
 	return 0;
 }
diff -puN drivers/media/dvb/ttpci/av7110.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/dvb/ttpci/av7110.c
diff -puN drivers/media/dvb/ttusb-dec/ttusb_dec.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/dvb/ttusb-dec/ttusb_dec.c
--- 25/drivers/media/dvb/ttusb-dec/ttusb_dec.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.916395736 -0800
+++ 25-akpm/drivers/media/dvb/ttusb-dec/ttusb_dec.c	2004-12-10 15:37:09.936392696 -0800
@@ -1090,7 +1090,7 @@ static int ttusb_dec_alloc_iso_urbs(stru
 
 static void ttusb_dec_init_tasklet(struct ttusb_dec *dec)
 {
-	dec->urb_frame_list_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dec->urb_frame_list_lock);
 	INIT_LIST_HEAD(&dec->urb_frame_list);
 	tasklet_init(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list,
 		     (unsigned long)dec);
@@ -1401,7 +1401,7 @@ static void ttusb_dec_exit_tasklet(struc
 static void ttusb_dec_init_filters(struct ttusb_dec *dec)
 {
 	INIT_LIST_HEAD(&dec->filter_info_list);
-	dec->filter_info_list_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dec->filter_info_list_lock);
 }
 
 static void ttusb_dec_exit_filters(struct ttusb_dec *dec)
diff -puN drivers/media/video/bttv-driver.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/video/bttv-driver.c
--- 25/drivers/media/video/bttv-driver.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.918395432 -0800
+++ 25-akpm/drivers/media/video/bttv-driver.c	2004-12-10 15:37:09.939392240 -0800
@@ -3717,8 +3717,8 @@ static int __devinit bttv_probe(struct p
 	/* initialize structs / fill in defaults */
         init_MUTEX(&btv->lock);
         init_MUTEX(&btv->reslock);
-        btv->s_lock    = SPIN_LOCK_UNLOCKED;
-        btv->gpio_lock = SPIN_LOCK_UNLOCKED;
+        spin_lock_init(&btv->s_lock);
+        spin_lock_init(&btv->gpio_lock);
         init_waitqueue_head(&btv->gpioq);
         init_waitqueue_head(&btv->i2c_queue);
         INIT_LIST_HEAD(&btv->c.subs);
diff -puN drivers/media/video/cx88/cx88-mpeg.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/video/cx88/cx88-mpeg.c
--- 25/drivers/media/video/cx88/cx88-mpeg.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.919395280 -0800
+++ 25-akpm/drivers/media/video/cx88/cx88-mpeg.c	2004-12-10 15:37:09.939392240 -0800
@@ -343,7 +343,7 @@ int cx8802_init_common(struct cx8802_dev
 
 	/* initialize driver struct */
         init_MUTEX(&dev->lock);
-	dev->slock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dev->slock);
 
 	/* init dma queue */
 	INIT_LIST_HEAD(&dev->mpegq.active);
diff -puN drivers/media/video/cx88/cx88-video.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/video/cx88/cx88-video.c
--- 25/drivers/media/video/cx88/cx88-video.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.921394976 -0800
+++ 25-akpm/drivers/media/video/cx88/cx88-video.c	2004-12-10 15:37:09.941391936 -0800
@@ -2026,7 +2026,7 @@ static int __devinit cx8800_initdev(stru
 
 	/* initialize driver struct */
         init_MUTEX(&dev->lock);
-	dev->slock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dev->slock);
 	core->tvnorm = tvnorms;
 
 	/* init video dma queues */
diff -puN drivers/media/video/meye.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/video/meye.c
--- 25/drivers/media/video/meye.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.922394824 -0800
+++ 25-akpm/drivers/media/video/meye.c	2004-12-10 15:37:09.943391632 -0800
@@ -1824,14 +1824,14 @@ static int __devinit meye_probe(struct p
 		goto outvmalloc;
 	}
 
-	meye.grabq_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&meye.grabq_lock);
 	meye.grabq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL,
 				 &meye.grabq_lock);
 	if (IS_ERR(meye.grabq)) {
 		printk(KERN_ERR "meye: fifo allocation failed\n");
 		goto outkfifoalloc1;
 	}
-	meye.doneq_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&meye.doneq_lock);
 	meye.doneq = kfifo_alloc(sizeof(int) * MEYE_MAX_BUFNBRS, GFP_KERNEL,
 				 &meye.doneq_lock);
 	if (IS_ERR(meye.doneq)) {
diff -puN drivers/media/video/saa7134/saa7134-core.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/video/saa7134/saa7134-core.c
--- 25/drivers/media/video/saa7134/saa7134-core.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.924394520 -0800
+++ 25-akpm/drivers/media/video/saa7134/saa7134-core.c	2004-12-10 15:37:09.944391480 -0800
@@ -630,7 +630,7 @@ static int saa7134_hwinit1(struct saa713
 	saa_writel(SAA7134_IRQ1, 0);
 	saa_writel(SAA7134_IRQ2, 0);
         init_MUTEX(&dev->lock);
-	dev->slock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dev->slock);
 
 	saa7134_track_gpio(dev,"pre-init");
 	saa7134_video_init1(dev);
diff -puN drivers/media/video/zr36120.c~lock-initializer-unifying-batch-2-media-drivers drivers/media/video/zr36120.c
--- 25/drivers/media/video/zr36120.c~lock-initializer-unifying-batch-2-media-drivers	2004-12-10 15:37:09.925394368 -0800
+++ 25-akpm/drivers/media/video/zr36120.c	2004-12-10 15:37:09.945391328 -0800
@@ -1950,7 +1950,7 @@ int __init init_zoran(int card)
 	ztv->tuner_type = 0;
 	ztv->running = 0;
 	ztv->users = 0;
-	ztv->lock = RW_LOCK_UNLOCKED;
+	rwlock_init(&ztv->lock);
 	ztv->workqueue = 0;
 	ztv->fieldnr = 0;
 	ztv->lastfieldnr = 0;
_
