From: 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 Acked-by: Ingo Molnar Signed-off-by: Andrew Morton --- 25-akpm/drivers/media/common/saa7146_core.c | 4 ++-- 25-akpm/drivers/media/dvb/b2c2/skystar2.c | 2 +- 25-akpm/drivers/media/dvb/ttpci/av7110.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 +- 10 files changed, 14 insertions(+), 14 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-11-10 20:44:19.816848264 -0800 +++ 25-akpm/drivers/media/common/saa7146_core.c 2004-11-10 20:44:19.834845528 -0800 @@ -427,8 +427,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-11-10 20:44:19.818847960 -0800 +++ 25-akpm/drivers/media/dvb/b2c2/skystar2.c 2004-11-10 20:44:19.836845224 -0800 @@ -1976,7 +1976,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 --- 25/drivers/media/dvb/ttpci/av7110.c~lock-initializer-unifying-batch-2-media-drivers 2004-11-10 20:44:19.819847808 -0800 +++ 25-akpm/drivers/media/dvb/ttpci/av7110.c 2004-11-10 20:44:19.837845072 -0800 @@ -1501,7 +1501,7 @@ static int av7110_attach(struct saa7146_ /* locks for data transfers from/to AV7110 */ spin_lock_init (&av7110->debilock); sema_init(&av7110->dcomlock, 1); - av7110->debilock=SPIN_LOCK_UNLOCKED; + spin_lock_init(&av7110->debilock); av7110->debitype=-1; /* default OSD window */ 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-11-10 20:44:19.821847504 -0800 +++ 25-akpm/drivers/media/dvb/ttusb-dec/ttusb_dec.c 2004-11-10 20:44:19.838844920 -0800 @@ -1125,7 +1125,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); @@ -1696,7 +1696,7 @@ static void ttusb_dec_exit_frontend(stru 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-11-10 20:44:19.823847200 -0800 +++ 25-akpm/drivers/media/video/bttv-driver.c 2004-11-10 20:44:19.851842944 -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-11-10 20:44:19.824847048 -0800 +++ 25-akpm/drivers/media/video/cx88/cx88-mpeg.c 2004-11-10 20:44:19.852842792 -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-11-10 20:44:19.826846744 -0800 +++ 25-akpm/drivers/media/video/cx88/cx88-video.c 2004-11-10 20:44:19.857842032 -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-11-10 20:44:19.827846592 -0800 +++ 25-akpm/drivers/media/video/meye.c 2004-11-10 20:44:19.859841728 -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-11-10 20:44:19.829846288 -0800 +++ 25-akpm/drivers/media/video/saa7134/saa7134-core.c 2004-11-10 20:44:19.860841576 -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-11-10 20:44:19.831845984 -0800 +++ 25-akpm/drivers/media/video/zr36120.c 2004-11-10 20:44:19.861841424 -0800 @@ -1953,7 +1953,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; _