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) { struct rio_usb_data *rio = &rio_instance; + /* against disconnect() */ + lock_kernel(); mutex_lock(&(rio->lock)); if (rio->isopen || !rio->present) { mutex_unlock(&(rio->lock)); + unlock_kernel(); return -EBUSY; } rio->isopen = 1; @@ -91,6 +94,7 @@ static int open_rio(struct inode *inode, struct file *file) mutex_unlock(&(rio->lock)); dev_info(&rio->rio_dev->dev, "Rio opened.\n"); + unlock_kernel(); return 0; } @@ -115,7 +119,6 @@ static long ioctl_rio(struct file *file, unsigned int cmd, unsigned long arg) int retries; int retval=0; - lock_kernel(); mutex_lock(&(rio->lock)); /* Sanity check to make sure rio is connected, powered, etc */ 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) err_out: mutex_unlock(&(rio->lock)); - unlock_kernel(); return retval; } @@ -489,6 +491,7 @@ static void disconnect_rio(struct usb_interface *intf) struct rio_usb_data *rio = usb_get_intfdata (intf); usb_set_intfdata (intf, NULL); + lock_kernel(); if (rio) { usb_deregister_dev(intf, &usb_rio_class); @@ -498,6 +501,7 @@ static void disconnect_rio(struct usb_interface *intf) /* better let it finish - the release will do whats needed */ rio->rio_dev = NULL; mutex_unlock(&(rio->lock)); + unlock_kernel(); return; } kfree(rio->ibuf); @@ -508,9 +512,10 @@ static void disconnect_rio(struct usb_interface *intf) rio->present = 0; mutex_unlock(&(rio->lock)); } + unlock_kernel(); } -static struct usb_device_id rio_table [] = { +static const struct usb_device_id rio_table[] = { { USB_DEVICE(0x0841, 1) }, /* Rio 500 */ { } /* Terminating entry */ }; |