Commit 55bdd209 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Linus Torvalds

[PATCH] Lock initializer unifying: sound

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: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 382608e4
...@@ -1191,7 +1191,7 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file) ...@@ -1191,7 +1191,7 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file)
wiinst->mmapped = 0; wiinst->mmapped = 0;
wiinst->total_recorded = 0; wiinst->total_recorded = 0;
wiinst->blocks = 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); tasklet_init(&wiinst->timer.tasklet, emu10k1_wavein_bh, (unsigned long) wave_dev);
wave_dev->wiinst = wiinst; wave_dev->wiinst = wiinst;
emu10k1_wavein_setformat(wave_dev, &wiinst->format); emu10k1_wavein_setformat(wave_dev, &wiinst->format);
...@@ -1235,7 +1235,7 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file) ...@@ -1235,7 +1235,7 @@ static int emu10k1_audio_open(struct inode *inode, struct file *file)
woinst->total_copied = 0; woinst->total_copied = 0;
woinst->total_played = 0; woinst->total_played = 0;
woinst->blocks = 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); tasklet_init(&woinst->timer.tasklet, emu10k1_waveout_bh, (unsigned long) wave_dev);
wave_dev->woinst = woinst; wave_dev->woinst = woinst;
emu10k1_waveout_setformat(wave_dev, &woinst->format); emu10k1_waveout_setformat(wave_dev, &woinst->format);
......
...@@ -524,7 +524,7 @@ static void __devinit timer_init(struct emu10k1_card *card) ...@@ -524,7 +524,7 @@ static void __devinit timer_init(struct emu10k1_card *card)
{ {
INIT_LIST_HEAD(&card->timers); INIT_LIST_HEAD(&card->timers);
card->timer_delay = TIMER_STOPPED; 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) static void __devinit addxmgr_init(struct emu10k1_card *card)
...@@ -873,7 +873,7 @@ static int __devinit fx_init(struct emu10k1_card *card) ...@@ -873,7 +873,7 @@ static int __devinit fx_init(struct emu10k1_card *card)
sblive_writeptr(card, DBG, 0, 0); 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 // Set up Volume controls, try to keep this the same for both Audigy and Live
......
...@@ -521,7 +521,7 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_ ...@@ -521,7 +521,7 @@ int sb_dsp_detect(struct address_info *hw_config, int pci, int pciio, struct sb_
DDB(printk("sb_dsp_detect(%x) entered\n", hw_config->io_base)); 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->type = hw_config->card_subtype;
devc->base = hw_config->io_base; devc->base = hw_config->io_base;
......
...@@ -256,7 +256,7 @@ static int __init li_create(lithium_t *lith, unsigned long baseaddr) ...@@ -256,7 +256,7 @@ static int __init li_create(lithium_t *lith, unsigned long baseaddr)
{ {
static void li_destroy(lithium_t *); 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->page0 = ioremap_nocache(baseaddr + LI_PAGE0_OFFSET, PAGE_SIZE);
lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE); lith->page1 = ioremap_nocache(baseaddr + LI_PAGE1_OFFSET, PAGE_SIZE);
lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE); lith->page2 = ioremap_nocache(baseaddr + LI_PAGE2_OFFSET, PAGE_SIZE);
...@@ -3380,13 +3380,13 @@ static int __init attach_vwsnd(struct address_info *hw_config) ...@@ -3380,13 +3380,13 @@ static int __init attach_vwsnd(struct address_info *hw_config)
init_MUTEX(&devc->io_sema); init_MUTEX(&devc->io_sema);
init_MUTEX(&devc->mix_sema); init_MUTEX(&devc->mix_sema);
devc->open_mode = 0; devc->open_mode = 0;
devc->rport.lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&devc->rport.lock);
init_waitqueue_head(&devc->rport.queue); init_waitqueue_head(&devc->rport.queue);
devc->rport.swstate = SW_OFF; devc->rport.swstate = SW_OFF;
devc->rport.hwstate = HW_STOPPED; devc->rport.hwstate = HW_STOPPED;
devc->rport.flags = 0; devc->rport.flags = 0;
devc->rport.swbuf = NULL; devc->rport.swbuf = NULL;
devc->wport.lock = SPIN_LOCK_UNLOCKED; spin_lock_init(&devc->wport.lock);
init_waitqueue_head(&devc->wport.queue); init_waitqueue_head(&devc->wport.queue);
devc->wport.swstate = SW_OFF; devc->wport.swstate = SW_OFF;
devc->wport.hwstate = HW_STOPPED; devc->wport.hwstate = HW_STOPPED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment