aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-08-11 03:36:51 -0400
committerJiri Kosina <jkosina@suse.cz>2010-08-11 03:36:51 -0400
commit6396fc3b3ff3f6b942992b653a62df11dcef9bea (patch)
treedb3c7cbe833b43c653adc99f70941431c5ff7c4e /drivers/usb/misc
parent4785879e4d340e24e54f6de2ccfc42728b912808 (diff)
parent3d30701b58970425e1d45994d6cb82f828924fdd (diff)
Merge branch 'master' into for-next
Conflicts: fs/exofs/inode.c
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/ftdi-elan.c4
-rw-r--r--drivers/usb/misc/iowarrior.c23
-rw-r--r--drivers/usb/misc/legousbtower.c6
-rw-r--r--drivers/usb/misc/rio500.c15
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c10
-rw-r--r--drivers/usb/misc/usblcd.c24
-rw-r--r--drivers/usb/misc/usbtest.c14
7 files changed, 53 insertions, 43 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c
index d7e034a5e1f9..c5b571050d8c 100644
--- a/drivers/usb/misc/ftdi-elan.c
+++ b/drivers/usb/misc/ftdi-elan.c
@@ -648,7 +648,7 @@ static int ftdi_elan_open(struct inode *inode, struct file *file)
648 648
649static int ftdi_elan_release(struct inode *inode, struct file *file) 649static int ftdi_elan_release(struct inode *inode, struct file *file)
650{ 650{
651 struct usb_ftdi *ftdi = (struct usb_ftdi *)file->private_data; 651 struct usb_ftdi *ftdi = file->private_data;
652 if (ftdi == NULL) 652 if (ftdi == NULL)
653 return -ENODEV; 653 return -ENODEV;
654 up(&ftdi->sw_lock); /* decrement the count on our device */ 654 up(&ftdi->sw_lock); /* decrement the count on our device */
@@ -671,7 +671,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer,
671 int bytes_read = 0; 671 int bytes_read = 0;
672 int retry_on_empty = 10; 672 int retry_on_empty = 10;
673 int retry_on_timeout = 5; 673 int retry_on_timeout = 5;
674 struct usb_ftdi *ftdi = (struct usb_ftdi *)file->private_data; 674 struct usb_ftdi *ftdi = file->private_data;
675 if (ftdi->disconnected > 0) { 675 if (ftdi->disconnected > 0) {
676 return -ENODEV; 676 return -ENODEV;
677 } 677 }
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c
index 7dc9d3c69984..2de49c8887c5 100644
--- a/drivers/usb/misc/iowarrior.c
+++ b/drivers/usb/misc/iowarrior.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/smp_lock.h> 21#include <linux/mutex.h>
22#include <linux/poll.h> 22#include <linux/poll.h>
23#include <linux/usb/iowarrior.h> 23#include <linux/usb/iowarrior.h>
24 24
@@ -61,6 +61,7 @@ MODULE_DESCRIPTION(DRIVER_DESC);
61MODULE_LICENSE("GPL"); 61MODULE_LICENSE("GPL");
62 62
63/* Module parameters */ 63/* Module parameters */
64static DEFINE_MUTEX(iowarrior_mutex);
64static int debug = 0; 65static int debug = 0;
65module_param(debug, bool, 0644); 66module_param(debug, bool, 0644);
66MODULE_PARM_DESC(debug, "debug=1 enables debugging messages"); 67MODULE_PARM_DESC(debug, "debug=1 enables debugging messages");
@@ -282,7 +283,7 @@ static ssize_t iowarrior_read(struct file *file, char __user *buffer,
282 int read_idx; 283 int read_idx;
283 int offset; 284 int offset;
284 285
285 dev = (struct iowarrior *)file->private_data; 286 dev = file->private_data;
286 287
287 /* verify that the device wasn't unplugged */ 288 /* verify that the device wasn't unplugged */
288 if (dev == NULL || !dev->present) 289 if (dev == NULL || !dev->present)
@@ -348,7 +349,7 @@ static ssize_t iowarrior_write(struct file *file,
348 char *buf = NULL; /* for IOW24 and IOW56 we need a buffer */ 349 char *buf = NULL; /* for IOW24 and IOW56 we need a buffer */
349 struct urb *int_out_urb = NULL; 350 struct urb *int_out_urb = NULL;
350 351
351 dev = (struct iowarrior *)file->private_data; 352 dev = file->private_data;
352 353
353 mutex_lock(&dev->mutex); 354 mutex_lock(&dev->mutex);
354 /* verify that the device wasn't unplugged */ 355 /* verify that the device wasn't unplugged */
@@ -483,7 +484,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
483 int retval; 484 int retval;
484 int io_res; /* checks for bytes read/written and copy_to/from_user results */ 485 int io_res; /* checks for bytes read/written and copy_to/from_user results */
485 486
486 dev = (struct iowarrior *)file->private_data; 487 dev = file->private_data;
487 if (dev == NULL) { 488 if (dev == NULL) {
488 return -ENODEV; 489 return -ENODEV;
489 } 490 }
@@ -493,7 +494,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
493 return -ENOMEM; 494 return -ENOMEM;
494 495
495 /* lock this object */ 496 /* lock this object */
496 lock_kernel(); 497 mutex_lock(&iowarrior_mutex);
497 mutex_lock(&dev->mutex); 498 mutex_lock(&dev->mutex);
498 499
499 /* verify that the device wasn't unplugged */ 500 /* verify that the device wasn't unplugged */
@@ -585,7 +586,7 @@ static long iowarrior_ioctl(struct file *file, unsigned int cmd,
585error_out: 586error_out:
586 /* unlock the device */ 587 /* unlock the device */
587 mutex_unlock(&dev->mutex); 588 mutex_unlock(&dev->mutex);
588 unlock_kernel(); 589 mutex_unlock(&iowarrior_mutex);
589 kfree(buffer); 590 kfree(buffer);
590 return retval; 591 return retval;
591} 592}
@@ -602,12 +603,12 @@ static int iowarrior_open(struct inode *inode, struct file *file)
602 603
603 dbg("%s", __func__); 604 dbg("%s", __func__);
604 605
605 lock_kernel(); 606 mutex_lock(&iowarrior_mutex);
606 subminor = iminor(inode); 607 subminor = iminor(inode);
607 608
608 interface = usb_find_interface(&iowarrior_driver, subminor); 609 interface = usb_find_interface(&iowarrior_driver, subminor);
609 if (!interface) { 610 if (!interface) {
610 unlock_kernel(); 611 mutex_unlock(&iowarrior_mutex);
611 err("%s - error, can't find device for minor %d", __func__, 612 err("%s - error, can't find device for minor %d", __func__,
612 subminor); 613 subminor);
613 return -ENODEV; 614 return -ENODEV;
@@ -617,7 +618,7 @@ static int iowarrior_open(struct inode *inode, struct file *file)
617 dev = usb_get_intfdata(interface); 618 dev = usb_get_intfdata(interface);
618 if (!dev) { 619 if (!dev) {
619 mutex_unlock(&iowarrior_open_disc_lock); 620 mutex_unlock(&iowarrior_open_disc_lock);
620 unlock_kernel(); 621 mutex_unlock(&iowarrior_mutex);
621 return -ENODEV; 622 return -ENODEV;
622 } 623 }
623 624
@@ -644,7 +645,7 @@ static int iowarrior_open(struct inode *inode, struct file *file)
644 645
645out: 646out:
646 mutex_unlock(&dev->mutex); 647 mutex_unlock(&dev->mutex);
647 unlock_kernel(); 648 mutex_unlock(&iowarrior_mutex);
648 return retval; 649 return retval;
649} 650}
650 651
@@ -656,7 +657,7 @@ static int iowarrior_release(struct inode *inode, struct file *file)
656 struct iowarrior *dev; 657 struct iowarrior *dev;
657 int retval = 0; 658 int retval = 0;
658 659
659 dev = (struct iowarrior *)file->private_data; 660 dev = file->private_data;
660 if (dev == NULL) { 661 if (dev == NULL) {
661 return -ENODEV; 662 return -ENODEV;
662 } 663 }
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index 8547bf9e3175..6482c6e2e6bd 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -448,7 +448,7 @@ static int tower_release (struct inode *inode, struct file *file)
448 448
449 dbg(2, "%s: enter", __func__); 449 dbg(2, "%s: enter", __func__);
450 450
451 dev = (struct lego_usb_tower *)file->private_data; 451 dev = file->private_data;
452 452
453 if (dev == NULL) { 453 if (dev == NULL) {
454 dbg(1, "%s: object is NULL", __func__); 454 dbg(1, "%s: object is NULL", __func__);
@@ -597,7 +597,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count,
597 597
598 dbg(2, "%s: enter, count = %Zd", __func__, count); 598 dbg(2, "%s: enter, count = %Zd", __func__, count);
599 599
600 dev = (struct lego_usb_tower *)file->private_data; 600 dev = file->private_data;
601 601
602 /* lock this object */ 602 /* lock this object */
603 if (mutex_lock_interruptible(&dev->lock)) { 603 if (mutex_lock_interruptible(&dev->lock)) {
@@ -686,7 +686,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t
686 686
687 dbg(2, "%s: enter, count = %Zd", __func__, count); 687 dbg(2, "%s: enter, count = %Zd", __func__, count);
688 688
689 dev = (struct lego_usb_tower *)file->private_data; 689 dev = file->private_data;
690 690
691 /* lock this object */ 691 /* lock this object */
692 if (mutex_lock_interruptible(&dev->lock)) { 692 if (mutex_lock_interruptible(&dev->lock)) {
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[] = {
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index d25814c172b2..70d00e99a4b4 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -2487,7 +2487,7 @@ sisusb_release(struct inode *inode, struct file *file)
2487{ 2487{
2488 struct sisusb_usb_data *sisusb; 2488 struct sisusb_usb_data *sisusb;
2489 2489
2490 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2490 if (!(sisusb = file->private_data))
2491 return -ENODEV; 2491 return -ENODEV;
2492 2492
2493 mutex_lock(&sisusb->lock); 2493 mutex_lock(&sisusb->lock);
@@ -2519,7 +2519,7 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
2519 u16 buf16; 2519 u16 buf16;
2520 u32 buf32, address; 2520 u32 buf32, address;
2521 2521
2522 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2522 if (!(sisusb = file->private_data))
2523 return -ENODEV; 2523 return -ENODEV;
2524 2524
2525 mutex_lock(&sisusb->lock); 2525 mutex_lock(&sisusb->lock);
@@ -2661,7 +2661,7 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
2661 u16 buf16; 2661 u16 buf16;
2662 u32 buf32, address; 2662 u32 buf32, address;
2663 2663
2664 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2664 if (!(sisusb = file->private_data))
2665 return -ENODEV; 2665 return -ENODEV;
2666 2666
2667 mutex_lock(&sisusb->lock); 2667 mutex_lock(&sisusb->lock);
@@ -2804,7 +2804,7 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
2804 struct sisusb_usb_data *sisusb; 2804 struct sisusb_usb_data *sisusb;
2805 loff_t ret; 2805 loff_t ret;
2806 2806
2807 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2807 if (!(sisusb = file->private_data))
2808 return -ENODEV; 2808 return -ENODEV;
2809 2809
2810 mutex_lock(&sisusb->lock); 2810 mutex_lock(&sisusb->lock);
@@ -2969,7 +2969,7 @@ sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2969 long retval = 0; 2969 long retval = 0;
2970 u32 __user *argp = (u32 __user *)arg; 2970 u32 __user *argp = (u32 __user *)arg;
2971 2971
2972 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2972 if (!(sisusb = file->private_data))
2973 return -ENODEV; 2973 return -ENODEV;
2974 2974
2975 mutex_lock(&sisusb->lock); 2975 mutex_lock(&sisusb->lock);
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
index 7828c764b323..d00dde19194c 100644
--- a/drivers/usb/misc/usblcd.c
+++ b/drivers/usb/misc/usblcd.c
@@ -16,7 +16,6 @@
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/smp_lock.h>
20#include <linux/errno.h> 19#include <linux/errno.h>
21#include <linux/mutex.h> 20#include <linux/mutex.h>
22#include <asm/uaccess.h> 21#include <asm/uaccess.h>
@@ -30,6 +29,7 @@
30#define IOCTL_GET_DRV_VERSION 2 29#define IOCTL_GET_DRV_VERSION 2
31 30
32 31
32static DEFINE_MUTEX(lcd_mutex);
33static const struct usb_device_id id_table[] = { 33static const struct usb_device_id id_table[] = {
34 { .idVendor = 0x10D2, .match_flags = USB_DEVICE_ID_MATCH_VENDOR, }, 34 { .idVendor = 0x10D2, .match_flags = USB_DEVICE_ID_MATCH_VENDOR, },
35 { }, 35 { },
@@ -74,12 +74,12 @@ static int lcd_open(struct inode *inode, struct file *file)
74 struct usb_interface *interface; 74 struct usb_interface *interface;
75 int subminor, r; 75 int subminor, r;
76 76
77 lock_kernel(); 77 mutex_lock(&lcd_mutex);
78 subminor = iminor(inode); 78 subminor = iminor(inode);
79 79
80 interface = usb_find_interface(&lcd_driver, subminor); 80 interface = usb_find_interface(&lcd_driver, subminor);
81 if (!interface) { 81 if (!interface) {
82 unlock_kernel(); 82 mutex_unlock(&lcd_mutex);
83 err ("USBLCD: %s - error, can't find device for minor %d", 83 err ("USBLCD: %s - error, can't find device for minor %d",
84 __func__, subminor); 84 __func__, subminor);
85 return -ENODEV; 85 return -ENODEV;
@@ -89,7 +89,7 @@ static int lcd_open(struct inode *inode, struct file *file)
89 dev = usb_get_intfdata(interface); 89 dev = usb_get_intfdata(interface);
90 if (!dev) { 90 if (!dev) {
91 mutex_unlock(&open_disc_mutex); 91 mutex_unlock(&open_disc_mutex);
92 unlock_kernel(); 92 mutex_unlock(&lcd_mutex);
93 return -ENODEV; 93 return -ENODEV;
94 } 94 }
95 95
@@ -101,13 +101,13 @@ static int lcd_open(struct inode *inode, struct file *file)
101 r = usb_autopm_get_interface(interface); 101 r = usb_autopm_get_interface(interface);
102 if (r < 0) { 102 if (r < 0) {
103 kref_put(&dev->kref, lcd_delete); 103 kref_put(&dev->kref, lcd_delete);
104 unlock_kernel(); 104 mutex_unlock(&lcd_mutex);
105 return r; 105 return r;
106 } 106 }
107 107
108 /* save our object in the file's private structure */ 108 /* save our object in the file's private structure */
109 file->private_data = dev; 109 file->private_data = dev;
110 unlock_kernel(); 110 mutex_unlock(&lcd_mutex);
111 111
112 return 0; 112 return 0;
113} 113}
@@ -116,7 +116,7 @@ static int lcd_release(struct inode *inode, struct file *file)
116{ 116{
117 struct usb_lcd *dev; 117 struct usb_lcd *dev;
118 118
119 dev = (struct usb_lcd *)file->private_data; 119 dev = file->private_data;
120 if (dev == NULL) 120 if (dev == NULL)
121 return -ENODEV; 121 return -ENODEV;
122 122
@@ -132,7 +132,7 @@ static ssize_t lcd_read(struct file *file, char __user * buffer, size_t count, l
132 int retval = 0; 132 int retval = 0;
133 int bytes_read; 133 int bytes_read;
134 134
135 dev = (struct usb_lcd *)file->private_data; 135 dev = file->private_data;
136 136
137 /* do a blocking bulk read to get data from the device */ 137 /* do a blocking bulk read to get data from the device */
138 retval = usb_bulk_msg(dev->udev, 138 retval = usb_bulk_msg(dev->udev,
@@ -158,20 +158,20 @@ static long lcd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
158 u16 bcdDevice; 158 u16 bcdDevice;
159 char buf[30]; 159 char buf[30];
160 160
161 dev = (struct usb_lcd *)file->private_data; 161 dev = file->private_data;
162 if (dev == NULL) 162 if (dev == NULL)
163 return -ENODEV; 163 return -ENODEV;
164 164
165 switch (cmd) { 165 switch (cmd) {
166 case IOCTL_GET_HARD_VERSION: 166 case IOCTL_GET_HARD_VERSION:
167 lock_kernel(); 167 mutex_lock(&lcd_mutex);
168 bcdDevice = le16_to_cpu((dev->udev)->descriptor.bcdDevice); 168 bcdDevice = le16_to_cpu((dev->udev)->descriptor.bcdDevice);
169 sprintf(buf,"%1d%1d.%1d%1d", 169 sprintf(buf,"%1d%1d.%1d%1d",
170 (bcdDevice & 0xF000)>>12, 170 (bcdDevice & 0xF000)>>12,
171 (bcdDevice & 0xF00)>>8, 171 (bcdDevice & 0xF00)>>8,
172 (bcdDevice & 0xF0)>>4, 172 (bcdDevice & 0xF0)>>4,
173 (bcdDevice & 0xF)); 173 (bcdDevice & 0xF));
174 unlock_kernel(); 174 mutex_unlock(&lcd_mutex);
175 if (copy_to_user((void __user *)arg,buf,strlen(buf))!=0) 175 if (copy_to_user((void __user *)arg,buf,strlen(buf))!=0)
176 return -EFAULT; 176 return -EFAULT;
177 break; 177 break;
@@ -217,7 +217,7 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz
217 struct urb *urb = NULL; 217 struct urb *urb = NULL;
218 char *buf = NULL; 218 char *buf = NULL;
219 219
220 dev = (struct usb_lcd *)file->private_data; 220 dev = file->private_data;
221 221
222 /* verify that we actually have some data to write */ 222 /* verify that we actually have some data to write */
223 if (count == 0) 223 if (count == 0)
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
index 16dffe99d9f1..eef370eb7a54 100644
--- a/drivers/usb/misc/usbtest.c
+++ b/drivers/usb/misc/usbtest.c
@@ -136,7 +136,7 @@ try_iso:
136 iso_out = e; 136 iso_out = e;
137 } 137 }
138 } 138 }
139 if ((in && out) || (iso_in && iso_out)) 139 if ((in && out) || iso_in || iso_out)
140 goto found; 140 goto found;
141 } 141 }
142 return -EINVAL; 142 return -EINVAL;
@@ -162,6 +162,9 @@ found:
162 dev->in_iso_pipe = usb_rcvisocpipe (udev, 162 dev->in_iso_pipe = usb_rcvisocpipe (udev,
163 iso_in->desc.bEndpointAddress 163 iso_in->desc.bEndpointAddress
164 & USB_ENDPOINT_NUMBER_MASK); 164 & USB_ENDPOINT_NUMBER_MASK);
165 }
166
167 if (iso_out) {
165 dev->iso_out = &iso_out->desc; 168 dev->iso_out = &iso_out->desc;
166 dev->out_iso_pipe = usb_sndisocpipe (udev, 169 dev->out_iso_pipe = usb_sndisocpipe (udev,
167 iso_out->desc.bEndpointAddress 170 iso_out->desc.bEndpointAddress
@@ -1378,7 +1381,6 @@ static void iso_callback (struct urb *urb)
1378 break; 1381 break;
1379 } 1382 }
1380 } 1383 }
1381 simple_free_urb (urb);
1382 1384
1383 ctx->pending--; 1385 ctx->pending--;
1384 if (ctx->pending == 0) { 1386 if (ctx->pending == 0) {
@@ -1495,6 +1497,7 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
1495 } 1497 }
1496 1498
1497 simple_free_urb (urbs [i]); 1499 simple_free_urb (urbs [i]);
1500 urbs[i] = NULL;
1498 context.pending--; 1501 context.pending--;
1499 context.submit_error = 1; 1502 context.submit_error = 1;
1500 break; 1503 break;
@@ -1504,6 +1507,10 @@ test_iso_queue (struct usbtest_dev *dev, struct usbtest_param *param,
1504 1507
1505 wait_for_completion (&context.done); 1508 wait_for_completion (&context.done);
1506 1509
1510 for (i = 0; i < param->sglen; i++) {
1511 if (urbs[i])
1512 simple_free_urb(urbs[i]);
1513 }
1507 /* 1514 /*
1508 * Isochronous transfers are expected to fail sometimes. As an 1515 * Isochronous transfers are expected to fail sometimes. As an
1509 * arbitrary limit, we will report an error if any submissions 1516 * arbitrary limit, we will report an error if any submissions
@@ -1548,6 +1555,7 @@ fail:
1548 * off just killing the userspace task and waiting for it to exit. 1555 * off just killing the userspace task and waiting for it to exit.
1549 */ 1556 */
1550 1557
1558/* No BKL needed */
1551static int 1559static int
1552usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf) 1560usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf)
1553{ 1561{
@@ -2170,7 +2178,7 @@ static struct usb_driver usbtest_driver = {
2170 .name = "usbtest", 2178 .name = "usbtest",
2171 .id_table = id_table, 2179 .id_table = id_table,
2172 .probe = usbtest_probe, 2180 .probe = usbtest_probe,
2173 .ioctl = usbtest_ioctl, 2181 .unlocked_ioctl = usbtest_ioctl,
2174 .disconnect = usbtest_disconnect, 2182 .disconnect = usbtest_disconnect,
2175 .suspend = usbtest_suspend, 2183 .suspend = usbtest_suspend,
2176 .resume = usbtest_resume, 2184 .resume = usbtest_resume,