aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/rio500.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:05:02 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-10 18:05:02 -0400
commit9895850b23886e030cd1e7241d5529a57e969c3d (patch)
tree1061626db450aeb72dcfcd247c24b33e5238c8c4 /drivers/usb/misc/rio500.c
parentfc385c313275b114bc6ad36e60c5177d63250548 (diff)
parentb58af4066d240b18b43f202e07b9ec7461d90b17 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (148 commits) USB: serial: fix stalled writes USB: remove fake "address-of" expressions USB: fix thread-unsafe anchor utiliy routines USB: usbtest: support test device with only one iso-in or iso-out endpoint USB: usbtest: avoid to free coherent buffer in atomic context USB: xhci: Set DMA mask for host. USB: xhci: Don't flush doorbell writes. USB: xhci: Reduce reads and writes of interrupter registers. USB: xhci: Make xhci_set_hc_event_deq() static. USB: xhci: Minimize HW event ring dequeue pointer writes. USB: xhci: Make xhci_handle_event() static. USB: xhci: Remove unnecessary reads of IRQ_PENDING register. USB: xhci: Performance - move xhci_work() into xhci_irq() USB: xhci: Performance - move interrupt handlers into xhci-ring.c USB: xhci: Performance - move functions that find ep ring. USB:: fix linux/usb.h kernel-doc warnings USB: add USB serial ssu100 driver USB: usb-storage: implement autosuspend USB: ehci: fix remove of ehci debugfs dir USB: Add USB 2.0 to ssb ohci driver ...
Diffstat (limited to 'drivers/usb/misc/rio500.c')
-rw-r--r--drivers/usb/misc/rio500.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
index a85771b1563d..cc13ae61712a 100644
--- a/drivers/usb/misc/rio500.c
+++ b/drivers/usb/misc/rio500.c
@@ -32,7 +32,7 @@
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/signal.h> 33#include <linux/signal.h>
34#include <linux/sched.h> 34#include <linux/sched.h>
35#include <linux/smp_lock.h> 35#include <linux/mutex.h>
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/random.h> 37#include <linux/random.h>
38#include <linux/poll.h> 38#include <linux/poll.h>
@@ -72,6 +72,7 @@ struct rio_usb_data {
72 struct mutex lock; /* general race avoidance */ 72 struct mutex lock; /* general race avoidance */
73}; 73};
74 74
75static DEFINE_MUTEX(rio500_mutex);
75static struct rio_usb_data rio_instance; 76static struct rio_usb_data rio_instance;
76 77
77static int open_rio(struct inode *inode, struct file *file) 78static int open_rio(struct inode *inode, struct file *file)
@@ -79,12 +80,12 @@ static int open_rio(struct inode *inode, struct file *file)
79 struct rio_usb_data *rio = &rio_instance; 80 struct rio_usb_data *rio = &rio_instance;
80 81
81 /* against disconnect() */ 82 /* against disconnect() */
82 lock_kernel(); 83 mutex_lock(&rio500_mutex);
83 mutex_lock(&(rio->lock)); 84 mutex_lock(&(rio->lock));
84 85
85 if (rio->isopen || !rio->present) { 86 if (rio->isopen || !rio->present) {
86 mutex_unlock(&(rio->lock)); 87 mutex_unlock(&(rio->lock));
87 unlock_kernel(); 88 mutex_unlock(&rio500_mutex);
88 return -EBUSY; 89 return -EBUSY;
89 } 90 }
90 rio->isopen = 1; 91 rio->isopen = 1;
@@ -94,7 +95,7 @@ static int open_rio(struct inode *inode, struct file *file)
94 mutex_unlock(&(rio->lock)); 95 mutex_unlock(&(rio->lock));
95 96
96 dev_info(&rio->rio_dev->dev, "Rio opened.\n"); 97 dev_info(&rio->rio_dev->dev, "Rio opened.\n");
97 unlock_kernel(); 98 mutex_unlock(&rio500_mutex);
98 99
99 return 0; 100 return 0;
100} 101}
@@ -491,7 +492,7 @@ static void disconnect_rio(struct usb_interface *intf)
491 struct rio_usb_data *rio = usb_get_intfdata (intf); 492 struct rio_usb_data *rio = usb_get_intfdata (intf);
492 493
493 usb_set_intfdata (intf, NULL); 494 usb_set_intfdata (intf, NULL);
494 lock_kernel(); 495 mutex_lock(&rio500_mutex);
495 if (rio) { 496 if (rio) {
496 usb_deregister_dev(intf, &usb_rio_class); 497 usb_deregister_dev(intf, &usb_rio_class);
497 498
@@ -501,7 +502,7 @@ static void disconnect_rio(struct usb_interface *intf)
501 /* better let it finish - the release will do whats needed */ 502 /* better let it finish - the release will do whats needed */
502 rio->rio_dev = NULL; 503 rio->rio_dev = NULL;
503 mutex_unlock(&(rio->lock)); 504 mutex_unlock(&(rio->lock));
504 unlock_kernel(); 505 mutex_unlock(&rio500_mutex);
505 return; 506 return;
506 } 507 }
507 kfree(rio->ibuf); 508 kfree(rio->ibuf);
@@ -512,7 +513,7 @@ static void disconnect_rio(struct usb_interface *intf)
512 rio->present = 0; 513 rio->present = 0;
513 mutex_unlock(&(rio->lock)); 514 mutex_unlock(&(rio->lock));
514 } 515 }
515 unlock_kernel(); 516 mutex_unlock(&rio500_mutex);
516} 517}
517 518
518static const struct usb_device_id rio_table[] = { 519static const struct usb_device_id rio_table[] = {