diff options
author | Arjan van de Ven <arjan@infradead.org> | 2006-01-11 09:55:29 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-03-20 17:49:55 -0500 |
commit | 4186ecf8ad16dd05759a09594de6a87e48759ba6 (patch) | |
tree | 3ee5292d9f4a36e3eb359b586289ec972bcbaf39 /drivers/usb/misc/legousbtower.c | |
parent | 35cce732d9d4d9af6b4ad4d26d8f8c0eddb573a2 (diff) |
[PATCH] USB: convert a bunch of USB semaphores to mutexes
the patch below converts a bunch of semaphores-used-as-mutex in the USB
code to mutexes
Signed-off-by: Arjan van de Ven <arjan@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/legousbtower.c')
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 1336745b8f55..779bcf0373ad 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -83,6 +83,7 @@ | |||
83 | #include <linux/module.h> | 83 | #include <linux/module.h> |
84 | #include <linux/smp_lock.h> | 84 | #include <linux/smp_lock.h> |
85 | #include <linux/completion.h> | 85 | #include <linux/completion.h> |
86 | #include <linux/mutex.h> | ||
86 | #include <asm/uaccess.h> | 87 | #include <asm/uaccess.h> |
87 | #include <linux/usb.h> | 88 | #include <linux/usb.h> |
88 | #include <linux/poll.h> | 89 | #include <linux/poll.h> |
@@ -256,7 +257,7 @@ static void tower_disconnect (struct usb_interface *interface); | |||
256 | 257 | ||
257 | 258 | ||
258 | /* prevent races between open() and disconnect */ | 259 | /* prevent races between open() and disconnect */ |
259 | static DECLARE_MUTEX (disconnect_sem); | 260 | static DEFINE_MUTEX (disconnect_mutex); |
260 | 261 | ||
261 | /* file operations needed when we register this driver */ | 262 | /* file operations needed when we register this driver */ |
262 | static struct file_operations tower_fops = { | 263 | static struct file_operations tower_fops = { |
@@ -349,7 +350,7 @@ static int tower_open (struct inode *inode, struct file *file) | |||
349 | nonseekable_open(inode, file); | 350 | nonseekable_open(inode, file); |
350 | subminor = iminor(inode); | 351 | subminor = iminor(inode); |
351 | 352 | ||
352 | down (&disconnect_sem); | 353 | mutex_lock (&disconnect_mutex); |
353 | 354 | ||
354 | interface = usb_find_interface (&tower_driver, subminor); | 355 | interface = usb_find_interface (&tower_driver, subminor); |
355 | 356 | ||
@@ -427,7 +428,7 @@ unlock_exit: | |||
427 | up (&dev->sem); | 428 | up (&dev->sem); |
428 | 429 | ||
429 | unlock_disconnect_exit: | 430 | unlock_disconnect_exit: |
430 | up (&disconnect_sem); | 431 | mutex_unlock (&disconnect_mutex); |
431 | 432 | ||
432 | dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval); | 433 | dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval); |
433 | 434 | ||
@@ -1005,7 +1006,7 @@ static void tower_disconnect (struct usb_interface *interface) | |||
1005 | 1006 | ||
1006 | dbg(2, "%s: enter", __FUNCTION__); | 1007 | dbg(2, "%s: enter", __FUNCTION__); |
1007 | 1008 | ||
1008 | down (&disconnect_sem); | 1009 | mutex_lock (&disconnect_mutex); |
1009 | 1010 | ||
1010 | dev = usb_get_intfdata (interface); | 1011 | dev = usb_get_intfdata (interface); |
1011 | usb_set_intfdata (interface, NULL); | 1012 | usb_set_intfdata (interface, NULL); |
@@ -1027,7 +1028,7 @@ static void tower_disconnect (struct usb_interface *interface) | |||
1027 | up (&dev->sem); | 1028 | up (&dev->sem); |
1028 | } | 1029 | } |
1029 | 1030 | ||
1030 | up (&disconnect_sem); | 1031 | mutex_unlock (&disconnect_mutex); |
1031 | 1032 | ||
1032 | info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE)); | 1033 | info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE)); |
1033 | 1034 | ||