media: video: usbvision: remove ctrlUrbLock
Subsystems (4)
PATCH 1/4 media: video: usbvision: remove ctrlUrbLock
The ctrlUrbLock has all it's users commented out, and so it's unused. This patch removes it.
Signed-off-by Daniel Walker <[email protected]>
--- drivers/media/video/usbvision/usbvision-core.c | 3 --- drivers/media/video/usbvision/usbvision-video.c | 1 - drivers/media/video/usbvision/usbvision.h | 1 - 3 files changed, 5 deletions(-)
drivers/media/video/usbvision/usbvision-core.c +0 -3
@@ -1561,13 +1561,10 @@ static int usbvision_write_reg_irq(strucif (len >8 ) {return -EFAULT ; } -// down(&usbvision->ctrlUrbLock); if (usbvision->ctrlUrbBusy) { -// up(&usbvision->ctrlUrbLock); return -EBUSY ; } usbvision->ctrlUrbBusy =1 ; -// up(&usbvision->ctrlUrbLock); usbvision->ctrlUrbSetup.bRequestType =USB_DIR_OUT |USB_TYPE_VENDOR |USB_RECIP_ENDPOINT ; usbvision->ctrlUrbSetup.bRequest =USBVISION_OP_CODE ;
drivers/media/video/usbvision/usbvision-video.c +0 -1
@@ -1650,7 +1650,6 @@ static struct usb_usbvision *usbvision_a goto err_exit; }init_waitqueue_head (&usbvision->ctrlUrb_wq); -init_MUTEX (&usbvision->ctrlUrbLock);/* to 1 == available */ usbvision_init_powerOffTimer (usbvision);
drivers/media/video/usbvision/usbvision.h +0 -1
@@ -374,7 +374,6 @@ struct usb_usbvision {int ctrlUrbBusy;struct usb_ctrlrequest ctrlUrbSetup;wait_queue_head_t ctrlUrb_wq;// Processes waiting -struct semaphore ctrlUrbLock;/* configuration part */ int have_tuner;
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/4 docs: kernel-locking: Convert semaphore references
I converted some of the document to reflect mutex usage instead of semaphore usage. Since we shouldin't be promoting semaphore usage when it's on it's way out..
Signed-off-by Daniel Walker <[email protected]>
--- Documentation/DocBook/kernel-locking.tmpl | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-)
Documentation/DocBook/kernel-locking.tmpl +16 -16
@@ -717,7 +717,7 @@ used, and when it gets full, throws out <para> For our first example, we assume that all operations are in user context (ie. from system calls), so we can sleep. This means we can -use a semaphore to protect the cache and all the objects within +use a mutex to protect the cache and all the objects within it. Here's the code: </para>
@@ -725,7 +725,7 @@ it. Here's the code: #include <linux/list.h> #include <linux/slab.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include <asm/errno.h> struct object
@@ -737,7 +737,7 @@ struct object }; /* Protects the cache, cache_num, and the objects within it */ -static DECLARE_MUTEX(cache_lock); +static DEFINE_MUTEX(cache_lock); static LIST_HEAD(cache); static unsigned int cache_num = 0; #define MAX_CACHE_SIZE 10
@@ -789,17 +789,17 @@ int cache_add(int id, const char *name) obj->id = id; obj->popularity = 0; - down(&cache_lock); + mutex_lock(&cache_lock); __cache_add(obj); - up(&cache_lock); + mutex_unlock(&cache_lock); return 0; } void cache_delete(int id) { - down(&cache_lock); + mutex_lock(&cache_lock); __cache_delete(__cache_find(id)); - up(&cache_lock); + mutex_unlock(&cache_lock); } int cache_find(int id, char *name)
@@ -807,13 +807,13 @@ int cache_find(int id, char *name) struct object *obj; int ret = -ENOENT; - down(&cache_lock); + mutex_lock(&cache_lock); obj = __cache_find(id); if (obj) { ret = 0; strcpy(name, obj->name); } - up(&cache_lock); + mutex_unlock(&cache_lock); return ret; } </programlisting>
@@ -853,7 +853,7 @@ The change is shown below, in standard p int popularity; }; --static DECLARE_MUTEX(cache_lock); +-static DEFINE_MUTEX(cache_lock); +static spinlock_t cache_lock = SPIN_LOCK_UNLOCKED; static LIST_HEAD(cache); static unsigned int cache_num = 0;
@@ -870,22 +870,22 @@ The change is shown below, in standard p obj->id = id; obj->popularity = 0; -- down(&cache_lock); +- mutex_lock(&cache_lock); + spin_lock_irqsave(&cache_lock, flags); __cache_add(obj); -- up(&cache_lock); +- mutex_unlock(&cache_lock); + spin_unlock_irqrestore(&cache_lock, flags); return 0; } void cache_delete(int id) { -- down(&cache_lock); +- mutex_lock(&cache_lock); + unsigned long flags; + + spin_lock_irqsave(&cache_lock, flags); __cache_delete(__cache_find(id)); -- up(&cache_lock); +- mutex_unlock(&cache_lock); + spin_unlock_irqrestore(&cache_lock, flags); }
@@ -895,14 +895,14 @@ The change is shown below, in standard p int ret = -ENOENT; + unsigned long flags; -- down(&cache_lock); +- mutex_lock(&cache_lock); + spin_lock_irqsave(&cache_lock, flags); obj = __cache_find(id); if (obj) { ret = 0; strcpy(name, obj->name); } -- up(&cache_lock); +- mutex_unlock(&cache_lock); + spin_unlock_irqrestore(&cache_lock, flags); return ret; }
PATCH 3/4 mcheck mce_64: mce_read_sem to mutex
In reply to a message not in the archiveConverted to a mutex, and changed the name to mce_read_mutex.
Signed-off-by Daniel Walker <[email protected]>
--- arch/x86/kernel/cpu/mcheck/mce_64.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/cpu/mcheck/mce_64.c +4 -4
@@ -564,7 +564,7 @@ static ssize_t mce_read(struct file *fil loff_t *off) {unsigned long *cpu_tsc; -static DECLARE_MUTEX (mce_read_sem); +static DEFINE_MUTEX (mce_read_mutex);unsigned next;char __user *buf = ubuf;int i, err;
@@ -573,12 +573,12 @@ static ssize_t mce_read(struct file *filif (!cpu_tsc)return -ENOMEM ; -down (&mce_read_sem); +mutex_lock (&mce_read_mutex); next =rcu_dereference (mcelog.next);/* Only supports full reads right now */ if (*off !=0 || usize <MCE_LOG_LEN *sizeof (struct mce )) { -up (&mce_read_sem); +mutex_unlock (&mce_read_mutex);kfree (cpu_tsc);return -EINVAL ; }
@@ -621,7 +621,7 @@ static ssize_t mce_read(struct file *filmemset (&mcelog.entry[i],0 ,sizeof (struct mce )); } } -up (&mce_read_sem); +mutex_unlock (&mce_read_mutex);kfree (cpu_tsc);return err ? -EFAULT : buf - ubuf; }
PATCH 4/4 md: dm driver: suspend_lock semaphore to mutex
In reply to a message not in the archiveSigned-off-by Daniel Walker <[email protected]>
--- drivers/md/dm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/md/dm.c +8 -8
@@ -73,7 +73,7 @@ union map_info *dm_get_mapinfo(struct bistruct mapped_device {struct rw_semaphore io_lock; -struct semaphore suspend_lock; +struct mutex suspend_lock;spinlock_t pushback_lock;rwlock_t map_lock;atomic_t holders;
@@ -982,7 +982,7 @@ static struct mapped_device *alloc_dev(imemset (md,0 ,sizeof (*md));init_rwsem (&md->io_lock); -init_MUTEX (&md->suspend_lock); +mutex_init (&md->suspend_lock);spin_lock_init (&md->pushback_lock);rwlock_init (&md->map_lock);atomic_set (&md->holders,1 );
@@ -1270,7 +1270,7 @@ int dm_swap_table(struct mapped_device * {int r = -EINVAL ; -down (&md->suspend_lock); +mutex_lock (&md->suspend_lock);/* device must be suspended */ if (!dm_suspended (md))
@@ -1285,7 +1285,7 @@ int dm_swap_table(struct mapped_device * r =__bind (md, table); out: -up (&md->suspend_lock); +mutex_unlock (&md->suspend_lock);return r; }
@@ -1341,7 +1341,7 @@ int dm_suspend(struct mapped_device *md,int do_lockfs = suspend_flags &DM_SUSPEND_LOCKFS_FLAG ?1 :0 ;int noflush = suspend_flags &DM_SUSPEND_NOFLUSH_FLAG ?1 :0 ; -down (&md->suspend_lock); +mutex_lock (&md->suspend_lock);if (dm_suspended (md)) goto out_unlock;
@@ -1462,7 +1462,7 @@ out:dm_table_put (map); out_unlock: -up (&md->suspend_lock); +mutex_unlock (&md->suspend_lock);return r; }
@@ -1472,7 +1472,7 @@ int dm_resume(struct mapped_device *md)struct bio *def;struct dm_table *map =NULL ; -down (&md->suspend_lock); +mutex_lock (&md->suspend_lock);if (!dm_suspended (md)) goto out;
@@ -1508,7 +1508,7 @@ int dm_resume(struct mapped_device *md) out:dm_table_put (map); -up (&md->suspend_lock); +mutex_unlock (&md->suspend_lock);return r; }