diff options
Diffstat (limited to 'drivers/usb/misc/rio500.c')
-rw-r--r-- | drivers/usb/misc/rio500.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 32d0199d0c32..a85771b1563d 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -78,10 +78,13 @@ static int open_rio(struct inode *inode, struct file *file) | |||
78 | { | 78 | { |
79 | struct rio_usb_data *rio = &rio_instance; | 79 | struct rio_usb_data *rio = &rio_instance; |
80 | 80 | ||
81 | /* against disconnect() */ | ||
82 | lock_kernel(); | ||
81 | mutex_lock(&(rio->lock)); | 83 | mutex_lock(&(rio->lock)); |
82 | 84 | ||
83 | if (rio->isopen || !rio->present) { | 85 | if (rio->isopen || !rio->present) { |
84 | mutex_unlock(&(rio->lock)); | 86 | mutex_unlock(&(rio->lock)); |
87 | unlock_kernel(); | ||
85 | return -EBUSY; | 88 | return -EBUSY; |
86 | } | 89 | } |
87 | rio->isopen = 1; | 90 | rio->isopen = 1; |
@@ -91,6 +94,7 @@ static int open_rio(struct inode *inode, struct file *file) | |||
91 | mutex_unlock(&(rio->lock)); | 94 | mutex_unlock(&(rio->lock)); |
92 | 95 | ||
93 | dev_info(&rio->rio_dev->dev, "Rio opened.\n"); | 96 | dev_info(&rio->rio_dev->dev, "Rio opened.\n"); |
97 | unlock_kernel(); | ||
94 | 98 | ||
95 | return 0; | 99 | return 0; |
96 | } | 100 | } |
@@ -115,7 +119,6 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
115 | int retries; | 119 | int retries; |
116 | int retval=0; | 120 | int retval=0; |
117 | 121 | ||
118 | lock_kernel(); | ||
119 | mutex_lock(&(rio->lock)); | 122 | mutex_lock(&(rio->lock)); |
120 | /* Sanity check to make sure rio is connected, powered, etc */ | 123 | /* Sanity check to make sure rio is connected, powered, etc */ |
121 | if (rio->present == 0 || rio->rio_dev == NULL) { | 124 | if (rio->present == 0 || rio->rio_dev == NULL) { |
@@ -254,7 +257,6 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) | |||
254 | 257 | ||
255 | err_out: | 258 | err_out: |
256 | mutex_unlock(&(rio->lock)); | 259 | mutex_unlock(&(rio->lock)); |
257 | unlock_kernel(); | ||
258 | return retval; | 260 | return retval; |
259 | } | 261 | } |
260 | 262 | ||
@@ -489,6 +491,7 @@ static void disconnect_rio(struct usb_interface *intf) | |||
489 | struct rio_usb_data *rio = usb_get_intfdata (intf); | 491 | struct rio_usb_data *rio = usb_get_intfdata (intf); |
490 | 492 | ||
491 | usb_set_intfdata (intf, NULL); | 493 | usb_set_intfdata (intf, NULL); |
494 | lock_kernel(); | ||
492 | if (rio) { | 495 | if (rio) { |
493 | usb_deregister_dev(intf, &usb_rio_class); | 496 | usb_deregister_dev(intf, &usb_rio_class); |
494 | 497 | ||
@@ -498,6 +501,7 @@ static void disconnect_rio(struct usb_interface *intf) | |||
498 | /* better let it finish - the release will do whats needed */ | 501 | /* better let it finish - the release will do whats needed */ |
499 | rio->rio_dev = NULL; | 502 | rio->rio_dev = NULL; |
500 | mutex_unlock(&(rio->lock)); | 503 | mutex_unlock(&(rio->lock)); |
504 | unlock_kernel(); | ||
501 | return; | 505 | return; |
502 | } | 506 | } |
503 | kfree(rio->ibuf); | 507 | kfree(rio->ibuf); |
@@ -508,9 +512,10 @@ static void disconnect_rio(struct usb_interface *intf) | |||
508 | rio->present = 0; | 512 | rio->present = 0; |
509 | mutex_unlock(&(rio->lock)); | 513 | mutex_unlock(&(rio->lock)); |
510 | } | 514 | } |
515 | unlock_kernel(); | ||
511 | } | 516 | } |
512 | 517 | ||
513 | static struct usb_device_id rio_table [] = { | 518 | static const struct usb_device_id rio_table[] = { |
514 | { USB_DEVICE(0x0841, 1) }, /* Rio 500 */ | 519 | { USB_DEVICE(0x0841, 1) }, /* Rio 500 */ |
515 | { } /* Terminating entry */ | 520 | { } /* Terminating entry */ |
516 | }; | 521 | }; |