diff options
Diffstat (limited to 'drivers/usb/misc/sisusbvga/sisusb.c')
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb.c | 38 |
1 files changed, 5 insertions, 33 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 6f8b134a79cb..9f37ba44c132 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c | |||
@@ -72,8 +72,6 @@ MODULE_PARM_DESC(last, "Number of last console to take over (1 - MAX_NR_CONSOLES | |||
72 | 72 | ||
73 | static struct usb_driver sisusb_driver; | 73 | static struct usb_driver sisusb_driver; |
74 | 74 | ||
75 | DEFINE_MUTEX(disconnect_mutex); | ||
76 | |||
77 | static void | 75 | static void |
78 | sisusb_free_buffers(struct sisusb_usb_data *sisusb) | 76 | sisusb_free_buffers(struct sisusb_usb_data *sisusb) |
79 | { | 77 | { |
@@ -2511,31 +2509,24 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2511 | struct usb_interface *interface; | 2509 | struct usb_interface *interface; |
2512 | int subminor = iminor(inode); | 2510 | int subminor = iminor(inode); |
2513 | 2511 | ||
2514 | mutex_lock(&disconnect_mutex); | ||
2515 | |||
2516 | if (!(interface = usb_find_interface(&sisusb_driver, subminor))) { | 2512 | if (!(interface = usb_find_interface(&sisusb_driver, subminor))) { |
2517 | printk(KERN_ERR "sisusb[%d]: Failed to find interface\n", | 2513 | printk(KERN_ERR "sisusb[%d]: Failed to find interface\n", |
2518 | subminor); | 2514 | subminor); |
2519 | mutex_unlock(&disconnect_mutex); | ||
2520 | return -ENODEV; | 2515 | return -ENODEV; |
2521 | } | 2516 | } |
2522 | 2517 | ||
2523 | if (!(sisusb = usb_get_intfdata(interface))) { | 2518 | if (!(sisusb = usb_get_intfdata(interface))) |
2524 | mutex_unlock(&disconnect_mutex); | ||
2525 | return -ENODEV; | 2519 | return -ENODEV; |
2526 | } | ||
2527 | 2520 | ||
2528 | mutex_lock(&sisusb->lock); | 2521 | mutex_lock(&sisusb->lock); |
2529 | 2522 | ||
2530 | if (!sisusb->present || !sisusb->ready) { | 2523 | if (!sisusb->present || !sisusb->ready) { |
2531 | mutex_unlock(&sisusb->lock); | 2524 | mutex_unlock(&sisusb->lock); |
2532 | mutex_unlock(&disconnect_mutex); | ||
2533 | return -ENODEV; | 2525 | return -ENODEV; |
2534 | } | 2526 | } |
2535 | 2527 | ||
2536 | if (sisusb->isopen) { | 2528 | if (sisusb->isopen) { |
2537 | mutex_unlock(&sisusb->lock); | 2529 | mutex_unlock(&sisusb->lock); |
2538 | mutex_unlock(&disconnect_mutex); | ||
2539 | return -EBUSY; | 2530 | return -EBUSY; |
2540 | } | 2531 | } |
2541 | 2532 | ||
@@ -2543,7 +2534,6 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2543 | if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) { | 2534 | if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) { |
2544 | if (sisusb_init_gfxdevice(sisusb, 0)) { | 2535 | if (sisusb_init_gfxdevice(sisusb, 0)) { |
2545 | mutex_unlock(&sisusb->lock); | 2536 | mutex_unlock(&sisusb->lock); |
2546 | mutex_unlock(&disconnect_mutex); | ||
2547 | printk(KERN_ERR | 2537 | printk(KERN_ERR |
2548 | "sisusbvga[%d]: Failed to initialize " | 2538 | "sisusbvga[%d]: Failed to initialize " |
2549 | "device\n", | 2539 | "device\n", |
@@ -2552,7 +2542,6 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2552 | } | 2542 | } |
2553 | } else { | 2543 | } else { |
2554 | mutex_unlock(&sisusb->lock); | 2544 | mutex_unlock(&sisusb->lock); |
2555 | mutex_unlock(&disconnect_mutex); | ||
2556 | printk(KERN_ERR | 2545 | printk(KERN_ERR |
2557 | "sisusbvga[%d]: Device not attached to " | 2546 | "sisusbvga[%d]: Device not attached to " |
2558 | "USB 2.0 hub\n", | 2547 | "USB 2.0 hub\n", |
@@ -2570,8 +2559,6 @@ sisusb_open(struct inode *inode, struct file *file) | |||
2570 | 2559 | ||
2571 | mutex_unlock(&sisusb->lock); | 2560 | mutex_unlock(&sisusb->lock); |
2572 | 2561 | ||
2573 | mutex_unlock(&disconnect_mutex); | ||
2574 | |||
2575 | return 0; | 2562 | return 0; |
2576 | } | 2563 | } |
2577 | 2564 | ||
@@ -2601,12 +2588,8 @@ sisusb_release(struct inode *inode, struct file *file) | |||
2601 | struct sisusb_usb_data *sisusb; | 2588 | struct sisusb_usb_data *sisusb; |
2602 | int myminor; | 2589 | int myminor; |
2603 | 2590 | ||
2604 | mutex_lock(&disconnect_mutex); | 2591 | if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) |
2605 | |||
2606 | if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) { | ||
2607 | mutex_unlock(&disconnect_mutex); | ||
2608 | return -ENODEV; | 2592 | return -ENODEV; |
2609 | } | ||
2610 | 2593 | ||
2611 | mutex_lock(&sisusb->lock); | 2594 | mutex_lock(&sisusb->lock); |
2612 | 2595 | ||
@@ -2626,8 +2609,6 @@ sisusb_release(struct inode *inode, struct file *file) | |||
2626 | /* decrement the usage count on our device */ | 2609 | /* decrement the usage count on our device */ |
2627 | kref_put(&sisusb->kref, sisusb_delete); | 2610 | kref_put(&sisusb->kref, sisusb_delete); |
2628 | 2611 | ||
2629 | mutex_unlock(&disconnect_mutex); | ||
2630 | |||
2631 | return 0; | 2612 | return 0; |
2632 | } | 2613 | } |
2633 | 2614 | ||
@@ -3383,12 +3364,9 @@ static void sisusb_disconnect(struct usb_interface *intf) | |||
3383 | sisusb_console_exit(sisusb); | 3364 | sisusb_console_exit(sisusb); |
3384 | #endif | 3365 | #endif |
3385 | 3366 | ||
3386 | /* The above code doesn't need the disconnect | 3367 | minor = sisusb->minor; |
3387 | * semaphore to be down; its meaning is to | 3368 | |
3388 | * protect all other routines from the disconnect | 3369 | usb_deregister_dev(intf, &usb_sisusb_class); |
3389 | * case, not the other way round. | ||
3390 | */ | ||
3391 | mutex_lock(&disconnect_mutex); | ||
3392 | 3370 | ||
3393 | mutex_lock(&sisusb->lock); | 3371 | mutex_lock(&sisusb->lock); |
3394 | 3372 | ||
@@ -3396,12 +3374,8 @@ static void sisusb_disconnect(struct usb_interface *intf) | |||
3396 | if (!sisusb_wait_all_out_complete(sisusb)) | 3374 | if (!sisusb_wait_all_out_complete(sisusb)) |
3397 | sisusb_kill_all_busy(sisusb); | 3375 | sisusb_kill_all_busy(sisusb); |
3398 | 3376 | ||
3399 | minor = sisusb->minor; | ||
3400 | |||
3401 | usb_set_intfdata(intf, NULL); | 3377 | usb_set_intfdata(intf, NULL); |
3402 | 3378 | ||
3403 | usb_deregister_dev(intf, &usb_sisusb_class); | ||
3404 | |||
3405 | #ifdef SISUSB_OLD_CONFIG_COMPAT | 3379 | #ifdef SISUSB_OLD_CONFIG_COMPAT |
3406 | if (sisusb->ioctl32registered) { | 3380 | if (sisusb->ioctl32registered) { |
3407 | int ret; | 3381 | int ret; |
@@ -3426,8 +3400,6 @@ static void sisusb_disconnect(struct usb_interface *intf) | |||
3426 | /* decrement our usage count */ | 3400 | /* decrement our usage count */ |
3427 | kref_put(&sisusb->kref, sisusb_delete); | 3401 | kref_put(&sisusb->kref, sisusb_delete); |
3428 | 3402 | ||
3429 | mutex_unlock(&disconnect_mutex); | ||
3430 | |||
3431 | printk(KERN_INFO "sisusbvga[%d]: Disconnected\n", minor); | 3403 | printk(KERN_INFO "sisusbvga[%d]: Disconnected\n", minor); |
3432 | } | 3404 | } |
3433 | 3405 | ||