summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/usblcd.c
diff options
context:
space:
mode:
authorOliver Neukum <oneukum@suse.de>2007-03-05 15:11:14 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2007-04-27 22:28:33 +0200
commit2e85c91e2e0f4e58fb54354bb7f6cc7dd3466dd9 (patch)
tree6954444d94c8f2ec38d9112c296c5198f3cbf961 /drivers/usb/misc/usblcd.c
parentUSB: kill BKL in skeleton driver (diff)
downloadlinux-2e85c91e2e0f4e58fb54354bb7f6cc7dd3466dd9.tar.xz
linux-2e85c91e2e0f4e58fb54354bb7f6cc7dd3466dd9.zip
USB: kill BKL in usblcd
this patch removes usage of BKL from usblcd, which got it from the old skeleton driver. Signed-off-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/usblcd.c')
-rw-r--r--drivers/usb/misc/usblcd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index ada2ebc464ae..887ef953f3d8 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -47,6 +47,7 @@ struct usb_lcd {
#define to_lcd_dev(d) container_of(d, struct usb_lcd, kref)
static struct usb_driver lcd_driver;
+static DEFINE_MUTEX(usb_lcd_open_mutex);
static void lcd_delete(struct kref *kref)
@@ -68,6 +69,7 @@ static int lcd_open(struct inode *inode, struct file *file)
subminor = iminor(inode);
+ mutex_lock(&usb_lcd_open_mutex);
interface = usb_find_interface(&lcd_driver, subminor);
if (!interface) {
err ("USBLCD: %s - error, can't find device for minor %d",
@@ -89,6 +91,7 @@ static int lcd_open(struct inode *inode, struct file *file)
file->private_data = dev;
exit:
+ mutex_unlock(&usb_lcd_open_mutex);
return retval;
}
@@ -347,7 +350,7 @@ static void lcd_disconnect(struct usb_interface *interface)
int minor = interface->minor;
/* prevent skel_open() from racing skel_disconnect() */
- lock_kernel();
+ mutex_lock(&usb_lcd_open_mutex);
dev = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL);
@@ -355,7 +358,7 @@ static void lcd_disconnect(struct usb_interface *interface)
/* give back our minor */
usb_deregister_dev(interface, &lcd_class);
- unlock_kernel();
+ mutex_unlock(&usb_lcd_open_mutex);
/* decrement our usage count */
kref_put(&dev->kref, lcd_delete);