Commit 9c901073 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Linus Torvalds

[PATCH] Lock initializer unifying: media drivers

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 3302bbdc
......@@ -426,8 +426,8 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent
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);
......
......@@ -1979,7 +1979,7 @@ static int driver_initialize(struct pci_dev *pdev)
ctrl_enable_mac(adapter, 1);
}
adapter->lock = SPIN_LOCK_UNLOCKED;
spin_lock_init(&adapter->lock);
return 0;
}
......
......@@ -1090,7 +1090,7 @@ static int ttusb_dec_alloc_iso_urbs(struct ttusb_dec *dec)
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(struct ttusb_dec *dec)
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)
......
......@@ -3717,8 +3717,8 @@ static int __devinit bttv_probe(struct pci_dev *dev,
/* 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);
......
......@@ -343,7 +343,7 @@ int cx8802_init_common(struct cx8802_dev *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);
......
......@@ -2026,7 +2026,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
/* initialize driver struct */
init_MUTEX(&dev->lock);
dev->slock = SPIN_LOCK_UNLOCKED;
spin_lock_init(&dev->slock);
core->tvnorm = tvnorms;
/* init video dma queues */
......
......@@ -1829,14 +1829,14 @@ static int __devinit meye_probe(struct pci_dev *pcidev,
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)) {
......
......@@ -630,7 +630,7 @@ static int saa7134_hwinit1(struct saa7134_dev *dev)
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);
......
......@@ -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;
......
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