diff options
author | Oliver Neukum <oliver@neukum.org> | 2010-01-13 09:33:15 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-02 17:54:23 -0500 |
commit | 86266452f80545285c14e20a8024f79c4fb88a86 (patch) | |
tree | ebb0a287f9bf189737d4924536d18b36492fd330 /drivers/usb/misc/sisusbvga | |
parent | f9de332ebf9df71892d52f7eb64af101a647349f (diff) |
USB: Push BKL on open down into the drivers
Straightforward push into the drivers to allow
auditing individual drivers separately
Signed-off-by: Oliver Neukum <oliver@neukum.org>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/sisusbvga')
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index bb0b315b521d..3991655f8f09 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -2416,21 +2416,28 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2416 | struct usb_interface *interface; | 2416 | struct usb_interface *interface; |
2417 | int subminor = iminor(inode); | 2417 | int subminor = iminor(inode); |
2418 | 2418 | ||
2419 | if (!(interface = usb_find_interface(&sisusb_driver, subminor))) | 2419 | lock_kernel(); |
2420 | if (!(interface = usb_find_interface(&sisusb_driver, subminor))) { | ||
2421 | unlock_kernel(); | ||
2420 | return -ENODEV; | 2422 | return -ENODEV; |
2423 | } | ||
2421 | 2424 | ||
2422 | if (!(sisusb = usb_get_intfdata(interface))) | 2425 | if (!(sisusb = usb_get_intfdata(interface))) { |
2426 | unlock_kernel(); | ||
2423 | return -ENODEV; | 2427 | return -ENODEV; |
2428 | } | ||
2424 | 2429 | ||
2425 | mutex_lock(&sisusb->lock); | 2430 | mutex_lock(&sisusb->lock); |
2426 | 2431 | ||
2427 | if (!sisusb->present || !sisusb->ready) { | 2432 | if (!sisusb->present || !sisusb->ready) { |
2428 | mutex_unlock(&sisusb->lock); | 2433 | mutex_unlock(&sisusb->lock); |
2434 | unlock_kernel(); | ||
2429 | return -ENODEV; | 2435 | return -ENODEV; |
2430 | } | 2436 | } |
2431 | 2437 | ||
2432 | if (sisusb->isopen) { | 2438 | if (sisusb->isopen) { |
2433 | mutex_unlock(&sisusb->lock); | 2439 | mutex_unlock(&sisusb->lock); |
2440 | unlock_kernel(); | ||
2434 | return -EBUSY; | 2441 | return -EBUSY; |
2435 | } | 2442 | } |
2436 | 2443 | ||
@@ -2439,11 +2446,13 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2439 | if (sisusb_init_gfxdevice(sisusb, 0)) { | 2446 | if (sisusb_init_gfxdevice(sisusb, 0)) { |
2440 | mutex_unlock(&sisusb->lock); | 2447 | mutex_unlock(&sisusb->lock); |
2441 | dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); | 2448 | dev_err(&sisusb->sisusb_dev->dev, "Failed to initialize device\n"); |
2449 | unlock_kernel(); | ||
2442 | return -EIO; | 2450 | return -EIO; |
2443 | } | 2451 | } |
2444 | } else { | 2452 | } else { |
2445 | mutex_unlock(&sisusb->lock); | 2453 | mutex_unlock(&sisusb->lock); |
2446 | dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n"); | 2454 | dev_err(&sisusb->sisusb_dev->dev, "Device not attached to USB 2.0 hub\n"); |
2455 | unlock_kernel(); | ||
2447 | return -EIO; | 2456 | return -EIO; |
2448 | } | 2457 | } |
2449 | } | 2458 | } |
@@ -2456,6 +2465,7 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2456 | file->private_data = sisusb; | 2465 | file->private_data = sisusb; |
2457 | 2466 | ||
2458 | mutex_unlock(&sisusb->lock); | 2467 | mutex_unlock(&sisusb->lock); |
2468 | unlock_kernel(); | ||
2459 | 2469 | ||
2460 | return 0; | 2470 | return 0; |
2461 | } | 2471 | } |