Skip to content

Commit 2e85c91

Browse files
Oliver Neukumgregkh
authored andcommitted
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>
1 parent 5d9b89b commit 2e85c91

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎drivers/usb/misc/usblcd.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct usb_lcd {
4747
#define to_lcd_dev(d) container_of(d, struct usb_lcd, kref)
4848

4949
static struct usb_driver lcd_driver;
50+
static DEFINE_MUTEX(usb_lcd_open_mutex);
5051

5152

5253
static void lcd_delete(struct kref *kref)
@@ -68,6 +69,7 @@ static int lcd_open(struct inode *inode, struct file *file)
6869

6970
subminor = iminor(inode);
7071

72+
mutex_lock(&usb_lcd_open_mutex);
7173
interface = usb_find_interface(&lcd_driver, subminor);
7274
if (!interface) {
7375
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)
8991
file->private_data = dev;
9092

9193
exit:
94+
mutex_unlock(&usb_lcd_open_mutex);
9295
return retval;
9396
}
9497

@@ -347,15 +350,15 @@ static void lcd_disconnect(struct usb_interface *interface)
347350
int minor = interface->minor;
348351

349352
/* prevent skel_open() from racing skel_disconnect() */
350-
lock_kernel();
353+
mutex_lock(&usb_lcd_open_mutex);
351354

352355
dev = usb_get_intfdata(interface);
353356
usb_set_intfdata(interface, NULL);
354357

355358
/* give back our minor */
356359
usb_deregister_dev(interface, &lcd_class);
357360

358-
unlock_kernel();
361+
mutex_unlock(&usb_lcd_open_mutex);
359362

360363
/* decrement our usage count */
361364
kref_put(&dev->kref, lcd_delete);

0 commit comments

Comments
 (0)