Commit 2e85c91e authored by Oliver Neukum's avatar Oliver Neukum Committed by Greg Kroah-Hartman

USB: kill BKL in usblcd

this patch removes usage of BKL from usblcd, which got it from the old
skeleton driver.
Signed-off-by: default avatarOliver Neukum <oneukum@suse.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5d9b89b3
...@@ -47,6 +47,7 @@ struct usb_lcd { ...@@ -47,6 +47,7 @@ struct usb_lcd {
#define to_lcd_dev(d) container_of(d, struct usb_lcd, kref) #define to_lcd_dev(d) container_of(d, struct usb_lcd, kref)
static struct usb_driver lcd_driver; static struct usb_driver lcd_driver;
static DEFINE_MUTEX(usb_lcd_open_mutex);
static void lcd_delete(struct kref *kref) static void lcd_delete(struct kref *kref)
...@@ -68,6 +69,7 @@ static int lcd_open(struct inode *inode, struct file *file) ...@@ -68,6 +69,7 @@ static int lcd_open(struct inode *inode, struct file *file)
subminor = iminor(inode); subminor = iminor(inode);
mutex_lock(&usb_lcd_open_mutex);
interface = usb_find_interface(&lcd_driver, subminor); interface = usb_find_interface(&lcd_driver, subminor);
if (!interface) { if (!interface) {
err ("USBLCD: %s - error, can't find device for minor %d", 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) ...@@ -89,6 +91,7 @@ static int lcd_open(struct inode *inode, struct file *file)
file->private_data = dev; file->private_data = dev;
exit: exit:
mutex_unlock(&usb_lcd_open_mutex);
return retval; return retval;
} }
...@@ -347,7 +350,7 @@ static void lcd_disconnect(struct usb_interface *interface) ...@@ -347,7 +350,7 @@ static void lcd_disconnect(struct usb_interface *interface)
int minor = interface->minor; int minor = interface->minor;
/* prevent skel_open() from racing skel_disconnect() */ /* prevent skel_open() from racing skel_disconnect() */
lock_kernel(); mutex_lock(&usb_lcd_open_mutex);
dev = usb_get_intfdata(interface); dev = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL); usb_set_intfdata(interface, NULL);
...@@ -355,7 +358,7 @@ static void lcd_disconnect(struct usb_interface *interface) ...@@ -355,7 +358,7 @@ static void lcd_disconnect(struct usb_interface *interface)
/* give back our minor */ /* give back our minor */
usb_deregister_dev(interface, &lcd_class); usb_deregister_dev(interface, &lcd_class);
unlock_kernel(); mutex_unlock(&usb_lcd_open_mutex);
/* decrement our usage count */ /* decrement our usage count */
kref_put(&dev->kref, lcd_delete); kref_put(&dev->kref, lcd_delete);
......
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