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/sound/oss/emu10k1/audio.c | 4 ++-- 25-akpm/sound/oss/emu10k1/main.c | 4 ++-- 25-akpm/sound/oss/sb_common.c | 2 +- 25-akpm/sound/oss/vwsnd.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff -puN sound/oss/emu10k1/audio.c~lock-initializer-unifying-batch-2-sound sound/oss/emu10k1/audio.c --- 25/sound/oss/emu10k1/audio.c~lock-initializer-unifying-batch-2-sound Thu Oct 28 15:55:42 2004 +++ 25-akpm/sound/oss/emu10k1/audio.c Thu Oct 28 15:55:42 2004 @@ -1191,7 +1191,7 @@ match: wiinst->mmapped = 0; wiinst->total_recorded = 0; wiinst->blocks = 0; - wiinst->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&wiinst->lock); tasklet_init(&wiinst->timer.tasklet, emu10k1_wavein_bh, (unsigned long) wave_dev); wave_dev->wiinst = wiinst; emu10k1_wavein_setformat(wave_dev, &wiinst->format); @@ -1235,7 +1235,7 @@ match: woinst->total_copied = 0; woinst->total_played = 0; woinst->blocks = 0; - woinst->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&woinst->lock); tasklet_init(&woinst->timer.tasklet, emu10k1_waveout_bh, (unsigned long) wave_dev); wave_dev->woinst = woinst; emu10k1_waveout_setformat(wave_dev, &woinst->format); diff -puN sound/oss/emu10k1/main.c~lock-initializer-unifying-batch-2-sound sound/oss/emu10k1/main.c --- 25/sound/oss/emu10k1/main.c~lock-initializer-unifying-batch-2-sound Thu Oct 28 15:55:42 2004 +++ 25-akpm/sound/oss/emu10k1/main.c Thu Oct 28 15:55:42 2004 @@ -524,7 +524,7 @@ static void __devinit timer_init(struct { INIT_LIST_HEAD(&card->timers); card->timer_delay = TIMER_STOPPED; - card->timer_lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&card->timer_lock); } static void __devinit addxmgr_init(struct emu10k1_card *card) @@ -873,7 +873,7 @@ static int __devinit fx_init(struct emu1 sblive_writeptr(card, DBG, 0, 0); } - mgr->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&mgr->lock); // Set up Volume controls, try to keep this the same for both Audigy and Live diff -puN sound/oss/sb_common.c~lock-initializer-unifying-batch-2-sound sound/oss/sb_common.c --- 25/sound/oss/sb_common.c~lock-initializer-unifying-batch-2-sound Thu Oct 28 15:55:42 2004 +++ 25-akpm/sound/oss/sb_common.c Thu Oct 28 15:55:42 2004 @@ -521,7 +521,7 @@ int sb_dsp_detect(struct address_info *h DDB(printk("sb_dsp_detect(%x) entered\n", hw_config->io_base)); - devc->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&devc->lock); devc->type = hw_config->card_subtype; devc->base = hw_config->io_base; diff -puN sound/oss/vwsnd.c~lock-initializer-unifying-batch-2-sound sound/oss/vwsnd.c --- 25/sound/oss/vwsnd.c~lock-initializer-unifying-batch-2-sound Thu Oct 28 15:55:42 2004 +++ 25-akpm/sound/oss/vwsnd.c Thu Oct 28 15:55:42 2004 @@ -256,7 +256,7 @@ static int __init li_create(lithium_t *l { static void li_destroy(lithium_t *); - lith->lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&lith->lock); lith->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE); lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE); lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE); @@ -3380,13 +3380,13 @@ static int __init attach_vwsnd(struct ad init_MUTEX(&devc->io_sema); init_MUTEX(&devc->mix_sema); devc->open_mode = 0; - devc->rport.lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&devc->rport.lock); init_waitqueue_head(&devc->rport.queue); devc->rport.swstate = SW_OFF; devc->rport.hwstate = HW_STOPPED; devc->rport.flags = 0; devc->rport.swbuf = NULL; - devc->wport.lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&devc->wport.lock); init_waitqueue_head(&devc->wport.queue); devc->wport.swstate = SW_OFF; devc->wport.hwstate = HW_STOPPED; _