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/ldusb.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/ldusb.c')
-rw-r--r-- | drivers/usb/misc/ldusb.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index f6bdaf08a80f..966acb474f67 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
36 | #include <linux/mutex.h> | ||
36 | 37 | ||
37 | #include <asm/uaccess.h> | 38 | #include <asm/uaccess.h> |
38 | #include <linux/input.h> | 39 | #include <linux/input.h> |
@@ -172,7 +173,7 @@ struct ld_usb { | |||
172 | }; | 173 | }; |
173 | 174 | ||
174 | /* prevent races between open() and disconnect() */ | 175 | /* prevent races between open() and disconnect() */ |
175 | static DECLARE_MUTEX(disconnect_sem); | 176 | static DEFINE_MUTEX(disconnect_mutex); |
176 | 177 | ||
177 | static struct usb_driver ld_usb_driver; | 178 | static struct usb_driver ld_usb_driver; |
178 | 179 | ||
@@ -293,7 +294,7 @@ static int ld_usb_open(struct inode *inode, struct file *file) | |||
293 | nonseekable_open(inode, file); | 294 | nonseekable_open(inode, file); |
294 | subminor = iminor(inode); | 295 | subminor = iminor(inode); |
295 | 296 | ||
296 | down(&disconnect_sem); | 297 | mutex_lock(&disconnect_mutex); |
297 | 298 | ||
298 | interface = usb_find_interface(&ld_usb_driver, subminor); | 299 | interface = usb_find_interface(&ld_usb_driver, subminor); |
299 | 300 | ||
@@ -355,7 +356,7 @@ unlock_exit: | |||
355 | up(&dev->sem); | 356 | up(&dev->sem); |
356 | 357 | ||
357 | unlock_disconnect_exit: | 358 | unlock_disconnect_exit: |
358 | up(&disconnect_sem); | 359 | mutex_unlock(&disconnect_mutex); |
359 | 360 | ||
360 | return retval; | 361 | return retval; |
361 | } | 362 | } |
@@ -740,7 +741,7 @@ static void ld_usb_disconnect(struct usb_interface *intf) | |||
740 | struct ld_usb *dev; | 741 | struct ld_usb *dev; |
741 | int minor; | 742 | int minor; |
742 | 743 | ||
743 | down(&disconnect_sem); | 744 | mutex_lock(&disconnect_mutex); |
744 | 745 | ||
745 | dev = usb_get_intfdata(intf); | 746 | dev = usb_get_intfdata(intf); |
746 | usb_set_intfdata(intf, NULL); | 747 | usb_set_intfdata(intf, NULL); |
@@ -761,7 +762,7 @@ static void ld_usb_disconnect(struct usb_interface *intf) | |||
761 | up(&dev->sem); | 762 | up(&dev->sem); |
762 | } | 763 | } |
763 | 764 | ||
764 | up(&disconnect_sem); | 765 | mutex_unlock(&disconnect_mutex); |
765 | 766 | ||
766 | dev_info(&intf->dev, "LD USB Device #%d now disconnected\n", | 767 | dev_info(&intf->dev, "LD USB Device #%d now disconnected\n", |
767 | (minor - USB_LD_MINOR_BASE)); | 768 | (minor - USB_LD_MINOR_BASE)); |