diff options
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/adutux.c | 59 | ||||
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 9 | ||||
-rw-r--r-- | drivers/usb/misc/auerswald.c | 29 | ||||
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 21 | ||||
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 21 | ||||
-rw-r--r-- | drivers/usb/misc/ldusb.c | 20 | ||||
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 28 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetkit.c | 13 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetmotorcontrol.c | 13 | ||||
-rw-r--r-- | drivers/usb/misc/usblcd.c | 11 | ||||
-rw-r--r-- | drivers/usb/misc/usbtest.c | 4 | ||||
-rw-r--r-- | drivers/usb/misc/uss720.c | 5 |
12 files changed, 128 insertions, 105 deletions
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index d72c42e5f22d..e9fdbc8997b3 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/module.h> | 25 | #include <linux/module.h> |
26 | #include <linux/usb.h> | 26 | #include <linux/usb.h> |
27 | #include <linux/mutex.h> | ||
27 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
28 | 29 | ||
29 | #ifdef CONFIG_USB_DEBUG | 30 | #ifdef CONFIG_USB_DEBUG |
@@ -80,7 +81,7 @@ MODULE_DEVICE_TABLE(usb, device_table); | |||
80 | 81 | ||
81 | /* Structure to hold all of our device specific stuff */ | 82 | /* Structure to hold all of our device specific stuff */ |
82 | struct adu_device { | 83 | struct adu_device { |
83 | struct semaphore sem; /* locks this structure */ | 84 | struct mutex mtx; /* locks this structure */ |
84 | struct usb_device* udev; /* save off the usb device pointer */ | 85 | struct usb_device* udev; /* save off the usb device pointer */ |
85 | struct usb_interface* interface; | 86 | struct usb_interface* interface; |
86 | unsigned char minor; /* the starting minor number for this device */ | 87 | unsigned char minor; /* the starting minor number for this device */ |
@@ -178,17 +179,18 @@ static void adu_delete(struct adu_device *dev) | |||
178 | static void adu_interrupt_in_callback(struct urb *urb) | 179 | static void adu_interrupt_in_callback(struct urb *urb) |
179 | { | 180 | { |
180 | struct adu_device *dev = urb->context; | 181 | struct adu_device *dev = urb->context; |
182 | int status = urb->status; | ||
181 | 183 | ||
182 | dbg(4," %s : enter, status %d", __FUNCTION__, urb->status); | 184 | dbg(4," %s : enter, status %d", __FUNCTION__, status); |
183 | adu_debug_data(5, __FUNCTION__, urb->actual_length, | 185 | adu_debug_data(5, __FUNCTION__, urb->actual_length, |
184 | urb->transfer_buffer); | 186 | urb->transfer_buffer); |
185 | 187 | ||
186 | spin_lock(&dev->buflock); | 188 | spin_lock(&dev->buflock); |
187 | 189 | ||
188 | if (urb->status != 0) { | 190 | if (status != 0) { |
189 | if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) { | 191 | if ((status != -ENOENT) && (status != -ECONNRESET)) { |
190 | dbg(1," %s : nonzero status received: %d", | 192 | dbg(1," %s : nonzero status received: %d", |
191 | __FUNCTION__, urb->status); | 193 | __FUNCTION__, status); |
192 | } | 194 | } |
193 | goto exit; | 195 | goto exit; |
194 | } | 196 | } |
@@ -216,21 +218,22 @@ exit: | |||
216 | wake_up_interruptible(&dev->read_wait); | 218 | wake_up_interruptible(&dev->read_wait); |
217 | adu_debug_data(5, __FUNCTION__, urb->actual_length, | 219 | adu_debug_data(5, __FUNCTION__, urb->actual_length, |
218 | urb->transfer_buffer); | 220 | urb->transfer_buffer); |
219 | dbg(4," %s : leave, status %d", __FUNCTION__, urb->status); | 221 | dbg(4," %s : leave, status %d", __FUNCTION__, status); |
220 | } | 222 | } |
221 | 223 | ||
222 | static void adu_interrupt_out_callback(struct urb *urb) | 224 | static void adu_interrupt_out_callback(struct urb *urb) |
223 | { | 225 | { |
224 | struct adu_device *dev = urb->context; | 226 | struct adu_device *dev = urb->context; |
227 | int status = urb->status; | ||
225 | 228 | ||
226 | dbg(4," %s : enter, status %d", __FUNCTION__, urb->status); | 229 | dbg(4," %s : enter, status %d", __FUNCTION__, status); |
227 | adu_debug_data(5,__FUNCTION__, urb->actual_length, urb->transfer_buffer); | 230 | adu_debug_data(5,__FUNCTION__, urb->actual_length, urb->transfer_buffer); |
228 | 231 | ||
229 | if (urb->status != 0) { | 232 | if (status != 0) { |
230 | if ((urb->status != -ENOENT) && | 233 | if ((status != -ENOENT) && |
231 | (urb->status != -ECONNRESET)) { | 234 | (status != -ECONNRESET)) { |
232 | dbg(1, " %s :nonzero status received: %d", | 235 | dbg(1, " %s :nonzero status received: %d", |
233 | __FUNCTION__, urb->status); | 236 | __FUNCTION__, status); |
234 | } | 237 | } |
235 | goto exit; | 238 | goto exit; |
236 | } | 239 | } |
@@ -240,7 +243,7 @@ exit: | |||
240 | 243 | ||
241 | adu_debug_data(5, __FUNCTION__, urb->actual_length, | 244 | adu_debug_data(5, __FUNCTION__, urb->actual_length, |
242 | urb->transfer_buffer); | 245 | urb->transfer_buffer); |
243 | dbg(4," %s : leave, status %d", __FUNCTION__, urb->status); | 246 | dbg(4," %s : leave, status %d", __FUNCTION__, status); |
244 | } | 247 | } |
245 | 248 | ||
246 | static int adu_open(struct inode *inode, struct file *file) | 249 | static int adu_open(struct inode *inode, struct file *file) |
@@ -269,8 +272,8 @@ static int adu_open(struct inode *inode, struct file *file) | |||
269 | } | 272 | } |
270 | 273 | ||
271 | /* lock this device */ | 274 | /* lock this device */ |
272 | if ((retval = down_interruptible(&dev->sem))) { | 275 | if ((retval = mutex_lock_interruptible(&dev->mtx))) { |
273 | dbg(2, "%s : sem down failed", __FUNCTION__); | 276 | dbg(2, "%s : mutex lock failed", __FUNCTION__); |
274 | goto exit_no_device; | 277 | goto exit_no_device; |
275 | } | 278 | } |
276 | 279 | ||
@@ -299,7 +302,7 @@ static int adu_open(struct inode *inode, struct file *file) | |||
299 | if (retval) | 302 | if (retval) |
300 | --dev->open_count; | 303 | --dev->open_count; |
301 | } | 304 | } |
302 | up(&dev->sem); | 305 | mutex_unlock(&dev->mtx); |
303 | 306 | ||
304 | exit_no_device: | 307 | exit_no_device: |
305 | dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); | 308 | dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); |
@@ -347,7 +350,7 @@ static int adu_release(struct inode *inode, struct file *file) | |||
347 | } | 350 | } |
348 | 351 | ||
349 | /* lock our device */ | 352 | /* lock our device */ |
350 | down(&dev->sem); /* not interruptible */ | 353 | mutex_lock(&dev->mtx); /* not interruptible */ |
351 | 354 | ||
352 | if (dev->open_count <= 0) { | 355 | if (dev->open_count <= 0) { |
353 | dbg(1," %s : device not opened", __FUNCTION__); | 356 | dbg(1," %s : device not opened", __FUNCTION__); |
@@ -357,7 +360,7 @@ static int adu_release(struct inode *inode, struct file *file) | |||
357 | 360 | ||
358 | if (dev->udev == NULL) { | 361 | if (dev->udev == NULL) { |
359 | /* the device was unplugged before the file was released */ | 362 | /* the device was unplugged before the file was released */ |
360 | up(&dev->sem); | 363 | mutex_unlock(&dev->mtx); |
361 | adu_delete(dev); | 364 | adu_delete(dev); |
362 | dev = NULL; | 365 | dev = NULL; |
363 | } else { | 366 | } else { |
@@ -367,7 +370,7 @@ static int adu_release(struct inode *inode, struct file *file) | |||
367 | 370 | ||
368 | exit: | 371 | exit: |
369 | if (dev) | 372 | if (dev) |
370 | up(&dev->sem); | 373 | mutex_unlock(&dev->mtx); |
371 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 374 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
372 | return retval; | 375 | return retval; |
373 | } | 376 | } |
@@ -390,7 +393,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
390 | dev = file->private_data; | 393 | dev = file->private_data; |
391 | dbg(2," %s : dev=%p", __FUNCTION__, dev); | 394 | dbg(2," %s : dev=%p", __FUNCTION__, dev); |
392 | /* lock this object */ | 395 | /* lock this object */ |
393 | if (down_interruptible(&dev->sem)) | 396 | if (mutex_lock_interruptible(&dev->mtx)) |
394 | return -ERESTARTSYS; | 397 | return -ERESTARTSYS; |
395 | 398 | ||
396 | /* verify that the device wasn't unplugged */ | 399 | /* verify that the device wasn't unplugged */ |
@@ -522,7 +525,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
522 | 525 | ||
523 | exit: | 526 | exit: |
524 | /* unlock the device */ | 527 | /* unlock the device */ |
525 | up(&dev->sem); | 528 | mutex_unlock(&dev->mtx); |
526 | 529 | ||
527 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 530 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
528 | return retval; | 531 | return retval; |
@@ -543,7 +546,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
543 | dev = file->private_data; | 546 | dev = file->private_data; |
544 | 547 | ||
545 | /* lock this object */ | 548 | /* lock this object */ |
546 | retval = down_interruptible(&dev->sem); | 549 | retval = mutex_lock_interruptible(&dev->mtx); |
547 | if (retval) | 550 | if (retval) |
548 | goto exit_nolock; | 551 | goto exit_nolock; |
549 | 552 | ||
@@ -571,9 +574,9 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
571 | retval = -EINTR; | 574 | retval = -EINTR; |
572 | goto exit; | 575 | goto exit; |
573 | } | 576 | } |
574 | up(&dev->sem); | 577 | mutex_unlock(&dev->mtx); |
575 | timeout = interruptible_sleep_on_timeout(&dev->write_wait, timeout); | 578 | timeout = interruptible_sleep_on_timeout(&dev->write_wait, timeout); |
576 | retval = down_interruptible(&dev->sem); | 579 | retval = mutex_lock_interruptible(&dev->mtx); |
577 | if (retval) { | 580 | if (retval) { |
578 | retval = bytes_written ? bytes_written : retval; | 581 | retval = bytes_written ? bytes_written : retval; |
579 | goto exit_nolock; | 582 | goto exit_nolock; |
@@ -638,7 +641,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
638 | 641 | ||
639 | exit: | 642 | exit: |
640 | /* unlock the device */ | 643 | /* unlock the device */ |
641 | up(&dev->sem); | 644 | mutex_unlock(&dev->mtx); |
642 | exit_nolock: | 645 | exit_nolock: |
643 | 646 | ||
644 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 647 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
@@ -698,7 +701,7 @@ static int adu_probe(struct usb_interface *interface, | |||
698 | goto exit; | 701 | goto exit; |
699 | } | 702 | } |
700 | 703 | ||
701 | init_MUTEX(&dev->sem); | 704 | mutex_init(&dev->mtx); |
702 | spin_lock_init(&dev->buflock); | 705 | spin_lock_init(&dev->buflock); |
703 | dev->udev = udev; | 706 | dev->udev = udev; |
704 | init_waitqueue_head(&dev->read_wait); | 707 | init_waitqueue_head(&dev->read_wait); |
@@ -835,16 +838,16 @@ static void adu_disconnect(struct usb_interface *interface) | |||
835 | usb_deregister_dev(interface, &adu_class); | 838 | usb_deregister_dev(interface, &adu_class); |
836 | dev->minor = 0; | 839 | dev->minor = 0; |
837 | 840 | ||
838 | down(&dev->sem); /* not interruptible */ | 841 | mutex_lock(&dev->mtx); /* not interruptible */ |
839 | 842 | ||
840 | /* if the device is not opened, then we clean up right now */ | 843 | /* if the device is not opened, then we clean up right now */ |
841 | dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); | 844 | dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); |
842 | if (!dev->open_count) { | 845 | if (!dev->open_count) { |
843 | up(&dev->sem); | 846 | mutex_unlock(&dev->mtx); |
844 | adu_delete(dev); | 847 | adu_delete(dev); |
845 | } else { | 848 | } else { |
846 | dev->udev = NULL; | 849 | dev->udev = NULL; |
847 | up(&dev->sem); | 850 | mutex_unlock(&dev->mtx); |
848 | } | 851 | } |
849 | 852 | ||
850 | dev_info(&interface->dev, "ADU device adutux%d now disconnected", | 853 | dev_info(&interface->dev, "ADU device adutux%d now disconnected", |
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 4e88553e1666..1cb56f2d5c84 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -88,9 +88,10 @@ static void appledisplay_complete(struct urb *urb) | |||
88 | { | 88 | { |
89 | struct appledisplay *pdata = urb->context; | 89 | struct appledisplay *pdata = urb->context; |
90 | unsigned long flags; | 90 | unsigned long flags; |
91 | int status = urb->status; | ||
91 | int retval; | 92 | int retval; |
92 | 93 | ||
93 | switch (urb->status) { | 94 | switch (status) { |
94 | case 0: | 95 | case 0: |
95 | /* success */ | 96 | /* success */ |
96 | break; | 97 | break; |
@@ -102,12 +103,12 @@ static void appledisplay_complete(struct urb *urb) | |||
102 | case -ENOENT: | 103 | case -ENOENT: |
103 | case -ESHUTDOWN: | 104 | case -ESHUTDOWN: |
104 | /* This urb is terminated, clean up */ | 105 | /* This urb is terminated, clean up */ |
105 | dbg("%s - urb shutting down with status: %d", | 106 | dbg("%s - urb shuttingdown with status: %d", |
106 | __FUNCTION__, urb->status); | 107 | __FUNCTION__, status); |
107 | return; | 108 | return; |
108 | default: | 109 | default: |
109 | dbg("%s - nonzero urb status received: %d", | 110 | dbg("%s - nonzero urb status received: %d", |
110 | __FUNCTION__, urb->status); | 111 | __FUNCTION__, status); |
111 | goto exit; | 112 | goto exit; |
112 | } | 113 | } |
113 | 114 | ||
diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 1fd5fc220cd7..df7e1ecc810a 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c | |||
@@ -630,7 +630,7 @@ static int auerchain_start_wait_urb (pauerchain_t acp, struct urb *urb, int time | |||
630 | } else | 630 | } else |
631 | status = urb->status; | 631 | status = urb->status; |
632 | 632 | ||
633 | if (actual_length) | 633 | if (status >= 0) |
634 | *actual_length = urb->actual_length; | 634 | *actual_length = urb->actual_length; |
635 | 635 | ||
636 | return status; | 636 | return status; |
@@ -664,7 +664,7 @@ static int auerchain_control_msg (pauerchain_t acp, struct usb_device *dev, unsi | |||
664 | int ret; | 664 | int ret; |
665 | struct usb_ctrlrequest *dr; | 665 | struct usb_ctrlrequest *dr; |
666 | struct urb *urb; | 666 | struct urb *urb; |
667 | int length; | 667 | int uninitialized_var(length); |
668 | 668 | ||
669 | dbg ("auerchain_control_msg"); | 669 | dbg ("auerchain_control_msg"); |
670 | dr = kmalloc (sizeof (struct usb_ctrlrequest), GFP_KERNEL); | 670 | dr = kmalloc (sizeof (struct usb_ctrlrequest), GFP_KERNEL); |
@@ -862,14 +862,16 @@ static void auerswald_ctrlread_wretcomplete (struct urb * urb) | |||
862 | pauerbuf_t bp = (pauerbuf_t) urb->context; | 862 | pauerbuf_t bp = (pauerbuf_t) urb->context; |
863 | pauerswald_t cp; | 863 | pauerswald_t cp; |
864 | int ret; | 864 | int ret; |
865 | int status = urb->status; | ||
866 | |||
865 | dbg ("auerswald_ctrlread_wretcomplete called"); | 867 | dbg ("auerswald_ctrlread_wretcomplete called"); |
866 | dbg ("complete with status: %d", urb->status); | 868 | dbg ("complete with status: %d", status); |
867 | cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); | 869 | cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); |
868 | 870 | ||
869 | /* check if it is possible to advance */ | 871 | /* check if it is possible to advance */ |
870 | if (!auerswald_status_retry (urb->status) || !cp->usbdev) { | 872 | if (!auerswald_status_retry(status) || !cp->usbdev) { |
871 | /* reuse the buffer */ | 873 | /* reuse the buffer */ |
872 | err ("control dummy: transmission error %d, can not retry", urb->status); | 874 | err ("control dummy: transmission error %d, can not retry", status); |
873 | auerbuf_releasebuf (bp); | 875 | auerbuf_releasebuf (bp); |
874 | /* Wake up all processes waiting for a buffer */ | 876 | /* Wake up all processes waiting for a buffer */ |
875 | wake_up (&cp->bufferwait); | 877 | wake_up (&cp->bufferwait); |
@@ -902,21 +904,23 @@ static void auerswald_ctrlread_complete (struct urb * urb) | |||
902 | pauerswald_t cp; | 904 | pauerswald_t cp; |
903 | pauerscon_t scp; | 905 | pauerscon_t scp; |
904 | pauerbuf_t bp = (pauerbuf_t) urb->context; | 906 | pauerbuf_t bp = (pauerbuf_t) urb->context; |
907 | int status = urb->status; | ||
905 | int ret; | 908 | int ret; |
909 | |||
906 | dbg ("auerswald_ctrlread_complete called"); | 910 | dbg ("auerswald_ctrlread_complete called"); |
907 | 911 | ||
908 | cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); | 912 | cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); |
909 | 913 | ||
910 | /* check if there is valid data in this urb */ | 914 | /* check if there is valid data in this urb */ |
911 | if (urb->status) { | 915 | if (status) { |
912 | dbg ("complete with non-zero status: %d", urb->status); | 916 | dbg ("complete with non-zero status: %d", status); |
913 | /* should we do a retry? */ | 917 | /* should we do a retry? */ |
914 | if (!auerswald_status_retry (urb->status) | 918 | if (!auerswald_status_retry(status) |
915 | || !cp->usbdev | 919 | || !cp->usbdev |
916 | || (cp->version < AUV_RETRY) | 920 | || (cp->version < AUV_RETRY) |
917 | || (bp->retries >= AU_RETRIES)) { | 921 | || (bp->retries >= AU_RETRIES)) { |
918 | /* reuse the buffer */ | 922 | /* reuse the buffer */ |
919 | err ("control read: transmission error %d, can not retry", urb->status); | 923 | err ("control read: transmission error %d, can not retry", status); |
920 | auerbuf_releasebuf (bp); | 924 | auerbuf_releasebuf (bp); |
921 | /* Wake up all processes waiting for a buffer */ | 925 | /* Wake up all processes waiting for a buffer */ |
922 | wake_up (&cp->bufferwait); | 926 | wake_up (&cp->bufferwait); |
@@ -974,12 +978,13 @@ static void auerswald_int_complete (struct urb * urb) | |||
974 | unsigned int channelid; | 978 | unsigned int channelid; |
975 | unsigned int bytecount; | 979 | unsigned int bytecount; |
976 | int ret; | 980 | int ret; |
981 | int status = urb->status; | ||
977 | pauerbuf_t bp = NULL; | 982 | pauerbuf_t bp = NULL; |
978 | pauerswald_t cp = (pauerswald_t) urb->context; | 983 | pauerswald_t cp = (pauerswald_t) urb->context; |
979 | 984 | ||
980 | dbg ("%s called", __FUNCTION__); | 985 | dbg ("%s called", __FUNCTION__); |
981 | 986 | ||
982 | switch (urb->status) { | 987 | switch (status) { |
983 | case 0: | 988 | case 0: |
984 | /* success */ | 989 | /* success */ |
985 | break; | 990 | break; |
@@ -987,10 +992,10 @@ static void auerswald_int_complete (struct urb * urb) | |||
987 | case -ENOENT: | 992 | case -ENOENT: |
988 | case -ESHUTDOWN: | 993 | case -ESHUTDOWN: |
989 | /* this urb is terminated, clean up */ | 994 | /* this urb is terminated, clean up */ |
990 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); | 995 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, status); |
991 | return; | 996 | return; |
992 | default: | 997 | default: |
993 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); | 998 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, status); |
994 | goto exit; | 999 | goto exit; |
995 | } | 1000 | } |
996 | 1001 | ||
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index e0f122e131d7..538b535e955b 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/module.h> | 45 | #include <linux/module.h> |
46 | #include <linux/kref.h> | 46 | #include <linux/kref.h> |
47 | #include <linux/mutex.h> | ||
47 | #include <asm/uaccess.h> | 48 | #include <asm/uaccess.h> |
48 | #include <linux/usb.h> | 49 | #include <linux/usb.h> |
49 | #include <linux/workqueue.h> | 50 | #include <linux/workqueue.h> |
@@ -64,7 +65,7 @@ static struct workqueue_struct *respond_queue; | |||
64 | * ftdi_module_lock exists to protect access to global variables | 65 | * ftdi_module_lock exists to protect access to global variables |
65 | * | 66 | * |
66 | */ | 67 | */ |
67 | static struct semaphore ftdi_module_lock; | 68 | static struct mutex ftdi_module_lock; |
68 | static int ftdi_instances = 0; | 69 | static int ftdi_instances = 0; |
69 | static struct list_head ftdi_static_list; | 70 | static struct list_head ftdi_static_list; |
70 | /* | 71 | /* |
@@ -199,10 +200,10 @@ static void ftdi_elan_delete(struct kref *kref) | |||
199 | dev_warn(&ftdi->udev->dev, "FREEING ftdi=%p\n", ftdi); | 200 | dev_warn(&ftdi->udev->dev, "FREEING ftdi=%p\n", ftdi); |
200 | usb_put_dev(ftdi->udev); | 201 | usb_put_dev(ftdi->udev); |
201 | ftdi->disconnected += 1; | 202 | ftdi->disconnected += 1; |
202 | down(&ftdi_module_lock); | 203 | mutex_lock(&ftdi_module_lock); |
203 | list_del_init(&ftdi->ftdi_list); | 204 | list_del_init(&ftdi->ftdi_list); |
204 | ftdi_instances -= 1; | 205 | ftdi_instances -= 1; |
205 | up(&ftdi_module_lock); | 206 | mutex_unlock(&ftdi_module_lock); |
206 | kfree(ftdi->bulk_in_buffer); | 207 | kfree(ftdi->bulk_in_buffer); |
207 | ftdi->bulk_in_buffer = NULL; | 208 | ftdi->bulk_in_buffer = NULL; |
208 | } | 209 | } |
@@ -746,10 +747,12 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer, | |||
746 | static void ftdi_elan_write_bulk_callback(struct urb *urb) | 747 | static void ftdi_elan_write_bulk_callback(struct urb *urb) |
747 | { | 748 | { |
748 | struct usb_ftdi *ftdi = (struct usb_ftdi *)urb->context; | 749 | struct usb_ftdi *ftdi = (struct usb_ftdi *)urb->context; |
749 | if (urb->status && !(urb->status == -ENOENT || urb->status == | 750 | int status = urb->status; |
750 | -ECONNRESET || urb->status == -ESHUTDOWN)) { | 751 | |
752 | if (status && !(status == -ENOENT || status == -ECONNRESET || | ||
753 | status == -ESHUTDOWN)) { | ||
751 | dev_err(&ftdi->udev->dev, "urb=%p write bulk status received: %" | 754 | dev_err(&ftdi->udev->dev, "urb=%p write bulk status received: %" |
752 | "d\n", urb, urb->status); | 755 | "d\n", urb, status); |
753 | } | 756 | } |
754 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 757 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, |
755 | urb->transfer_buffer, urb->transfer_dma); | 758 | urb->transfer_buffer, urb->transfer_dma); |
@@ -2780,10 +2783,10 @@ static int ftdi_elan_probe(struct usb_interface *interface, | |||
2780 | return -ENOMEM; | 2783 | return -ENOMEM; |
2781 | } | 2784 | } |
2782 | memset(ftdi, 0x00, sizeof(struct usb_ftdi)); | 2785 | memset(ftdi, 0x00, sizeof(struct usb_ftdi)); |
2783 | down(&ftdi_module_lock); | 2786 | mutex_lock(&ftdi_module_lock); |
2784 | list_add_tail(&ftdi->ftdi_list, &ftdi_static_list); | 2787 | list_add_tail(&ftdi->ftdi_list, &ftdi_static_list); |
2785 | ftdi->sequence_num = ++ftdi_instances; | 2788 | ftdi->sequence_num = ++ftdi_instances; |
2786 | up(&ftdi_module_lock); | 2789 | mutex_unlock(&ftdi_module_lock); |
2787 | ftdi_elan_init_kref(ftdi); | 2790 | ftdi_elan_init_kref(ftdi); |
2788 | init_MUTEX(&ftdi->sw_lock); | 2791 | init_MUTEX(&ftdi->sw_lock); |
2789 | ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); | 2792 | ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); |
@@ -2909,7 +2912,7 @@ static int __init ftdi_elan_init(void) | |||
2909 | int result; | 2912 | int result; |
2910 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, | 2913 | printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name, |
2911 | __TIME__, __DATE__); | 2914 | __TIME__, __DATE__); |
2912 | init_MUTEX(&ftdi_module_lock); | 2915 | mutex_init(&ftdi_module_lock); |
2913 | INIT_LIST_HEAD(&ftdi_static_list); | 2916 | INIT_LIST_HEAD(&ftdi_static_list); |
2914 | status_queue = create_singlethread_workqueue("ftdi-status-control"); | 2917 | status_queue = create_singlethread_workqueue("ftdi-status-control"); |
2915 | if (!status_queue) | 2918 | if (!status_queue) |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 28548d186712..46d9f27ec173 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -158,9 +158,10 @@ static void iowarrior_callback(struct urb *urb) | |||
158 | int read_idx; | 158 | int read_idx; |
159 | int aux_idx; | 159 | int aux_idx; |
160 | int offset; | 160 | int offset; |
161 | int status; | 161 | int status = urb->status; |
162 | int retval; | ||
162 | 163 | ||
163 | switch (urb->status) { | 164 | switch (status) { |
164 | case 0: | 165 | case 0: |
165 | /* success */ | 166 | /* success */ |
166 | break; | 167 | break; |
@@ -213,10 +214,10 @@ static void iowarrior_callback(struct urb *urb) | |||
213 | wake_up_interruptible(&dev->read_wait); | 214 | wake_up_interruptible(&dev->read_wait); |
214 | 215 | ||
215 | exit: | 216 | exit: |
216 | status = usb_submit_urb(urb, GFP_ATOMIC); | 217 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
217 | if (status) | 218 | if (retval) |
218 | dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d", | 219 | dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d", |
219 | __FUNCTION__, status); | 220 | __FUNCTION__, retval); |
220 | 221 | ||
221 | } | 222 | } |
222 | 223 | ||
@@ -226,13 +227,15 @@ exit: | |||
226 | static void iowarrior_write_callback(struct urb *urb) | 227 | static void iowarrior_write_callback(struct urb *urb) |
227 | { | 228 | { |
228 | struct iowarrior *dev; | 229 | struct iowarrior *dev; |
230 | int status = urb->status; | ||
231 | |||
229 | dev = (struct iowarrior *)urb->context; | 232 | dev = (struct iowarrior *)urb->context; |
230 | /* sync/async unlink faults aren't errors */ | 233 | /* sync/async unlink faults aren't errors */ |
231 | if (urb->status && | 234 | if (status && |
232 | !(urb->status == -ENOENT || | 235 | !(status == -ENOENT || |
233 | urb->status == -ECONNRESET || urb->status == -ESHUTDOWN)) { | 236 | status == -ECONNRESET || status == -ESHUTDOWN)) { |
234 | dbg("%s - nonzero write bulk status received: %d", | 237 | dbg("%s - nonzero write bulk status received: %d", |
235 | __func__, urb->status); | 238 | __func__, status); |
236 | } | 239 | } |
237 | /* free up our allocated buffer */ | 240 | /* free up our allocated buffer */ |
238 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 241 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, |
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 5e950b90c541..8208496dfc63 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c | |||
@@ -219,16 +219,17 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) | |||
219 | struct ld_usb *dev = urb->context; | 219 | struct ld_usb *dev = urb->context; |
220 | size_t *actual_buffer; | 220 | size_t *actual_buffer; |
221 | unsigned int next_ring_head; | 221 | unsigned int next_ring_head; |
222 | int status = urb->status; | ||
222 | int retval; | 223 | int retval; |
223 | 224 | ||
224 | if (urb->status) { | 225 | if (status) { |
225 | if (urb->status == -ENOENT || | 226 | if (status == -ENOENT || |
226 | urb->status == -ECONNRESET || | 227 | status == -ECONNRESET || |
227 | urb->status == -ESHUTDOWN) { | 228 | status == -ESHUTDOWN) { |
228 | goto exit; | 229 | goto exit; |
229 | } else { | 230 | } else { |
230 | dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", | 231 | dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", |
231 | __FUNCTION__, urb->status); | 232 | __FUNCTION__, status); |
232 | spin_lock(&dev->rbsl); | 233 | spin_lock(&dev->rbsl); |
233 | goto resubmit; /* maybe we can recover */ | 234 | goto resubmit; /* maybe we can recover */ |
234 | } | 235 | } |
@@ -275,14 +276,15 @@ exit: | |||
275 | static void ld_usb_interrupt_out_callback(struct urb *urb) | 276 | static void ld_usb_interrupt_out_callback(struct urb *urb) |
276 | { | 277 | { |
277 | struct ld_usb *dev = urb->context; | 278 | struct ld_usb *dev = urb->context; |
279 | int status = urb->status; | ||
278 | 280 | ||
279 | /* sync/async unlink faults aren't errors */ | 281 | /* sync/async unlink faults aren't errors */ |
280 | if (urb->status && !(urb->status == -ENOENT || | 282 | if (status && !(status == -ENOENT || |
281 | urb->status == -ECONNRESET || | 283 | status == -ECONNRESET || |
282 | urb->status == -ESHUTDOWN)) | 284 | status == -ESHUTDOWN)) |
283 | dbg_info(&dev->intf->dev, | 285 | dbg_info(&dev->intf->dev, |
284 | "%s - nonzero write interrupt status received: %d\n", | 286 | "%s - nonzero write interrupt status received: %d\n", |
285 | __FUNCTION__, urb->status); | 287 | __FUNCTION__, status); |
286 | 288 | ||
287 | dev->interrupt_out_busy = 0; | 289 | dev->interrupt_out_busy = 0; |
288 | wake_up_interruptible(&dev->write_wait); | 290 | wake_up_interruptible(&dev->write_wait); |
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 2ed0daea894c..561970b889a5 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -742,19 +742,20 @@ exit: | |||
742 | static void tower_interrupt_in_callback (struct urb *urb) | 742 | static void tower_interrupt_in_callback (struct urb *urb) |
743 | { | 743 | { |
744 | struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; | 744 | struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; |
745 | int status = urb->status; | ||
745 | int retval; | 746 | int retval; |
746 | 747 | ||
747 | dbg(4, "%s: enter, status %d", __FUNCTION__, urb->status); | 748 | dbg(4, "%s: enter, status %d", __FUNCTION__, status); |
748 | 749 | ||
749 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); | 750 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); |
750 | 751 | ||
751 | if (urb->status) { | 752 | if (status) { |
752 | if (urb->status == -ENOENT || | 753 | if (status == -ENOENT || |
753 | urb->status == -ECONNRESET || | 754 | status == -ECONNRESET || |
754 | urb->status == -ESHUTDOWN) { | 755 | status == -ESHUTDOWN) { |
755 | goto exit; | 756 | goto exit; |
756 | } else { | 757 | } else { |
757 | dbg(1, "%s: nonzero status received: %d", __FUNCTION__, urb->status); | 758 | dbg(1, "%s: nonzero status received: %d", __FUNCTION__, status); |
758 | goto resubmit; /* maybe we can recover */ | 759 | goto resubmit; /* maybe we can recover */ |
759 | } | 760 | } |
760 | } | 761 | } |
@@ -788,7 +789,7 @@ exit: | |||
788 | wake_up_interruptible (&dev->read_wait); | 789 | wake_up_interruptible (&dev->read_wait); |
789 | 790 | ||
790 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); | 791 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); |
791 | dbg(4, "%s: leave, status %d", __FUNCTION__, urb->status); | 792 | dbg(4, "%s: leave, status %d", __FUNCTION__, status); |
792 | } | 793 | } |
793 | 794 | ||
794 | 795 | ||
@@ -798,23 +799,24 @@ exit: | |||
798 | static void tower_interrupt_out_callback (struct urb *urb) | 799 | static void tower_interrupt_out_callback (struct urb *urb) |
799 | { | 800 | { |
800 | struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; | 801 | struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; |
802 | int status = urb->status; | ||
801 | 803 | ||
802 | dbg(4, "%s: enter, status %d", __FUNCTION__, urb->status); | 804 | dbg(4, "%s: enter, status %d", __FUNCTION__, status); |
803 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); | 805 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); |
804 | 806 | ||
805 | /* sync/async unlink faults aren't errors */ | 807 | /* sync/async unlink faults aren't errors */ |
806 | if (urb->status && !(urb->status == -ENOENT || | 808 | if (status && !(status == -ENOENT || |
807 | urb->status == -ECONNRESET || | 809 | status == -ECONNRESET || |
808 | urb->status == -ESHUTDOWN)) { | 810 | status == -ESHUTDOWN)) { |
809 | dbg(1, "%s - nonzero write bulk status received: %d", | 811 | dbg(1, "%s - nonzero write bulk status received: %d", |
810 | __FUNCTION__, urb->status); | 812 | __FUNCTION__, status); |
811 | } | 813 | } |
812 | 814 | ||
813 | dev->interrupt_out_busy = 0; | 815 | dev->interrupt_out_busy = 0; |
814 | wake_up_interruptible(&dev->write_wait); | 816 | wake_up_interruptible(&dev->write_wait); |
815 | 817 | ||
816 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); | 818 | lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); |
817 | dbg(4, "%s: leave, status %d", __FUNCTION__, urb->status); | 819 | dbg(4, "%s: leave, status %d", __FUNCTION__, status); |
818 | } | 820 | } |
819 | 821 | ||
820 | 822 | ||
diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index 371bf2b1197d..aa9bcceabe74 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c | |||
@@ -305,9 +305,10 @@ static void interfacekit_irq(struct urb *urb) | |||
305 | struct interfacekit *kit = urb->context; | 305 | struct interfacekit *kit = urb->context; |
306 | unsigned char *buffer = kit->data; | 306 | unsigned char *buffer = kit->data; |
307 | int i, level, sensor; | 307 | int i, level, sensor; |
308 | int status; | 308 | int retval; |
309 | int status = urb->status; | ||
309 | 310 | ||
310 | switch (urb->status) { | 311 | switch (status) { |
311 | case 0: /* success */ | 312 | case 0: /* success */ |
312 | break; | 313 | break; |
313 | case -ECONNRESET: /* unlink */ | 314 | case -ECONNRESET: /* unlink */ |
@@ -377,11 +378,11 @@ static void interfacekit_irq(struct urb *urb) | |||
377 | schedule_delayed_work(&kit->do_notify, 0); | 378 | schedule_delayed_work(&kit->do_notify, 0); |
378 | 379 | ||
379 | resubmit: | 380 | resubmit: |
380 | status = usb_submit_urb(urb, GFP_ATOMIC); | 381 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
381 | if (status) | 382 | if (retval) |
382 | err("can't resubmit intr, %s-%s/interfacekit0, status %d", | 383 | err("can't resubmit intr, %s-%s/interfacekit0, retval %d", |
383 | kit->udev->bus->bus_name, | 384 | kit->udev->bus->bus_name, |
384 | kit->udev->devpath, status); | 385 | kit->udev->devpath, retval); |
385 | } | 386 | } |
386 | 387 | ||
387 | static void do_notify(struct work_struct *work) | 388 | static void do_notify(struct work_struct *work) |
diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index 5727e1ea2f91..df0ebcdb9d6a 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c | |||
@@ -95,9 +95,10 @@ static void motorcontrol_irq(struct urb *urb) | |||
95 | struct motorcontrol *mc = urb->context; | 95 | struct motorcontrol *mc = urb->context; |
96 | unsigned char *buffer = mc->data; | 96 | unsigned char *buffer = mc->data; |
97 | int i, level; | 97 | int i, level; |
98 | int status; | 98 | int retval; |
99 | int status = urb->status;; | ||
99 | 100 | ||
100 | switch (urb->status) { | 101 | switch (status) { |
101 | case 0: /* success */ | 102 | case 0: /* success */ |
102 | break; | 103 | break; |
103 | case -ECONNRESET: /* unlink */ | 104 | case -ECONNRESET: /* unlink */ |
@@ -151,12 +152,12 @@ static void motorcontrol_irq(struct urb *urb) | |||
151 | schedule_delayed_work(&mc->do_notify, 0); | 152 | schedule_delayed_work(&mc->do_notify, 0); |
152 | 153 | ||
153 | resubmit: | 154 | resubmit: |
154 | status = usb_submit_urb(urb, GFP_ATOMIC); | 155 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
155 | if (status) | 156 | if (retval) |
156 | dev_err(&mc->intf->dev, | 157 | dev_err(&mc->intf->dev, |
157 | "can't resubmit intr, %s-%s/motorcontrol0, status %d", | 158 | "can't resubmit intr, %s-%s/motorcontrol0, retval %d", |
158 | mc->udev->bus->bus_name, | 159 | mc->udev->bus->bus_name, |
159 | mc->udev->devpath, status); | 160 | mc->udev->devpath, retval); |
160 | } | 161 | } |
161 | 162 | ||
162 | static void do_notify(struct work_struct *work) | 163 | static void do_notify(struct work_struct *work) |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 504f7221b0d0..719842032712 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -176,16 +176,17 @@ static int lcd_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u | |||
176 | static void lcd_write_bulk_callback(struct urb *urb) | 176 | static void lcd_write_bulk_callback(struct urb *urb) |
177 | { | 177 | { |
178 | struct usb_lcd *dev; | 178 | struct usb_lcd *dev; |
179 | int status = urb->status; | ||
179 | 180 | ||
180 | dev = (struct usb_lcd *)urb->context; | 181 | dev = (struct usb_lcd *)urb->context; |
181 | 182 | ||
182 | /* sync/async unlink faults aren't errors */ | 183 | /* sync/async unlink faults aren't errors */ |
183 | if (urb->status && | 184 | if (status && |
184 | !(urb->status == -ENOENT || | 185 | !(status == -ENOENT || |
185 | urb->status == -ECONNRESET || | 186 | status == -ECONNRESET || |
186 | urb->status == -ESHUTDOWN)) { | 187 | status == -ESHUTDOWN)) { |
187 | dbg("USBLCD: %s - nonzero write bulk status received: %d", | 188 | dbg("USBLCD: %s - nonzero write bulk status received: %d", |
188 | __FUNCTION__, urb->status); | 189 | __FUNCTION__, status); |
189 | } | 190 | } |
190 | 191 | ||
191 | /* free up our allocated buffer */ | 192 | /* free up our allocated buffer */ |
diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index fb321864a92d..e901d31e051b 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c | |||
@@ -768,8 +768,8 @@ static void ctrl_complete (struct urb *urb) | |||
768 | 768 | ||
769 | /* some faults are allowed, not required */ | 769 | /* some faults are allowed, not required */ |
770 | if (subcase->expected > 0 && ( | 770 | if (subcase->expected > 0 && ( |
771 | ((urb->status == -subcase->expected /* happened */ | 771 | ((status == -subcase->expected /* happened */ |
772 | || urb->status == 0)))) /* didn't */ | 772 | || status == 0)))) /* didn't */ |
773 | status = 0; | 773 | status = 0; |
774 | /* sometimes more than one fault is allowed */ | 774 | /* sometimes more than one fault is allowed */ |
775 | else if (subcase->number == 12 && status == -EPIPE) | 775 | else if (subcase->number == 12 && status == -EPIPE) |
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 1a60f9c473ad..2734fe2b9c43 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c | |||
@@ -111,12 +111,13 @@ static void async_complete(struct urb *urb) | |||
111 | struct uss720_async_request *rq; | 111 | struct uss720_async_request *rq; |
112 | struct parport *pp; | 112 | struct parport *pp; |
113 | struct parport_uss720_private *priv; | 113 | struct parport_uss720_private *priv; |
114 | int status = urb->status; | ||
114 | 115 | ||
115 | rq = urb->context; | 116 | rq = urb->context; |
116 | priv = rq->priv; | 117 | priv = rq->priv; |
117 | pp = priv->pp; | 118 | pp = priv->pp; |
118 | if (urb->status) { | 119 | if (status) { |
119 | err("async_complete: urb error %d", urb->status); | 120 | err("async_complete: urb error %d", status); |
120 | } else if (rq->dr.bRequest == 3) { | 121 | } else if (rq->dr.bRequest == 3) { |
121 | memcpy(priv->reg, rq->reg, sizeof(priv->reg)); | 122 | memcpy(priv->reg, rq->reg, sizeof(priv->reg)); |
122 | #if 0 | 123 | #if 0 |