aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-08 11:26:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-08 11:26:51 -0400
commite3fa252a0ef3d1f93bc55cefc2f707359b43c70d (patch)
tree03dd106086b09479ade278273d9c1db2445b801d /drivers/usb
parent0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff)
parenta2457ee691edeffb511dbff9a69008f480192197 (diff)
Merge 3.2-rc1 into usb-linus
This is needed to catch the resume bug that was bothering lots of us from testing some XHCI bug fixes in the suspend/resume path. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig16
-rw-r--r--drivers/usb/core/message.c11
-rw-r--r--drivers/usb/core/urb.c12
-rw-r--r--drivers/usb/gadget/inode.c1
-rw-r--r--drivers/usb/storage/usb.c30
5 files changed, 56 insertions, 14 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index cbd8f5f80596..76316a33061b 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -2,14 +2,6 @@
2# USB device configuration 2# USB device configuration
3# 3#
4 4
5menuconfig USB_SUPPORT
6 bool "USB support"
7 depends on HAS_IOMEM
8 default y
9 ---help---
10 This option adds core support for Universal Serial Bus (USB).
11 You will also need drivers from the following menu to make use of it.
12
13# many non-PCI SOC chips embed OHCI 5# many non-PCI SOC chips embed OHCI
14config USB_ARCH_HAS_OHCI 6config USB_ARCH_HAS_OHCI
15 boolean 7 boolean
@@ -63,6 +55,14 @@ config USB_ARCH_HAS_XHCI
63 boolean 55 boolean
64 default PCI 56 default PCI
65 57
58menuconfig USB_SUPPORT
59 bool "USB support"
60 depends on HAS_IOMEM
61 default y
62 ---help---
63 This option adds core support for Universal Serial Bus (USB).
64 You will also need drivers from the following menu to make use of it.
65
66if USB_SUPPORT 66if USB_SUPPORT
67 67
68config USB_COMMON 68config USB_COMMON
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b3bdfede45e6..aed3e07942d4 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -308,7 +308,8 @@ static void sg_complete(struct urb *urb)
308 retval = usb_unlink_urb(io->urbs [i]); 308 retval = usb_unlink_urb(io->urbs [i]);
309 if (retval != -EINPROGRESS && 309 if (retval != -EINPROGRESS &&
310 retval != -ENODEV && 310 retval != -ENODEV &&
311 retval != -EBUSY) 311 retval != -EBUSY &&
312 retval != -EIDRM)
312 dev_err(&io->dev->dev, 313 dev_err(&io->dev->dev,
313 "%s, unlink --> %d\n", 314 "%s, unlink --> %d\n",
314 __func__, retval); 315 __func__, retval);
@@ -317,7 +318,6 @@ static void sg_complete(struct urb *urb)
317 } 318 }
318 spin_lock(&io->lock); 319 spin_lock(&io->lock);
319 } 320 }
320 urb->dev = NULL;
321 321
322 /* on the last completion, signal usb_sg_wait() */ 322 /* on the last completion, signal usb_sg_wait() */
323 io->bytes += urb->actual_length; 323 io->bytes += urb->actual_length;
@@ -524,7 +524,6 @@ void usb_sg_wait(struct usb_sg_request *io)
524 case -ENXIO: /* hc didn't queue this one */ 524 case -ENXIO: /* hc didn't queue this one */
525 case -EAGAIN: 525 case -EAGAIN:
526 case -ENOMEM: 526 case -ENOMEM:
527 io->urbs[i]->dev = NULL;
528 retval = 0; 527 retval = 0;
529 yield(); 528 yield();
530 break; 529 break;
@@ -542,7 +541,6 @@ void usb_sg_wait(struct usb_sg_request *io)
542 541
543 /* fail any uncompleted urbs */ 542 /* fail any uncompleted urbs */
544 default: 543 default:
545 io->urbs[i]->dev = NULL;
546 io->urbs[i]->status = retval; 544 io->urbs[i]->status = retval;
547 dev_dbg(&io->dev->dev, "%s, submit --> %d\n", 545 dev_dbg(&io->dev->dev, "%s, submit --> %d\n",
548 __func__, retval); 546 __func__, retval);
@@ -593,7 +591,10 @@ void usb_sg_cancel(struct usb_sg_request *io)
593 if (!io->urbs [i]->dev) 591 if (!io->urbs [i]->dev)
594 continue; 592 continue;
595 retval = usb_unlink_urb(io->urbs [i]); 593 retval = usb_unlink_urb(io->urbs [i]);
596 if (retval != -EINPROGRESS && retval != -EBUSY) 594 if (retval != -EINPROGRESS
595 && retval != -ENODEV
596 && retval != -EBUSY
597 && retval != -EIDRM)
597 dev_warn(&io->dev->dev, "%s, unlink --> %d\n", 598 dev_warn(&io->dev->dev, "%s, unlink --> %d\n",
598 __func__, retval); 599 __func__, retval);
599 } 600 }
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index 7239a73c1b8c..cd9b3a2cd8a7 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -539,6 +539,10 @@ EXPORT_SYMBOL_GPL(usb_submit_urb);
539 * never submitted, or it was unlinked before, or the hardware is already 539 * never submitted, or it was unlinked before, or the hardware is already
540 * finished with it), even if the completion handler has not yet run. 540 * finished with it), even if the completion handler has not yet run.
541 * 541 *
542 * The URB must not be deallocated while this routine is running. In
543 * particular, when a driver calls this routine, it must insure that the
544 * completion handler cannot deallocate the URB.
545 *
542 * Unlinking and Endpoint Queues: 546 * Unlinking and Endpoint Queues:
543 * 547 *
544 * [The behaviors and guarantees described below do not apply to virtual 548 * [The behaviors and guarantees described below do not apply to virtual
@@ -603,6 +607,10 @@ EXPORT_SYMBOL_GPL(usb_unlink_urb);
603 * with error -EPERM. Thus even if the URB's completion handler always 607 * with error -EPERM. Thus even if the URB's completion handler always
604 * tries to resubmit, it will not succeed and the URB will become idle. 608 * tries to resubmit, it will not succeed and the URB will become idle.
605 * 609 *
610 * The URB must not be deallocated while this routine is running. In
611 * particular, when a driver calls this routine, it must insure that the
612 * completion handler cannot deallocate the URB.
613 *
606 * This routine may not be used in an interrupt context (such as a bottom 614 * This routine may not be used in an interrupt context (such as a bottom
607 * half or a completion handler), or when holding a spinlock, or in other 615 * half or a completion handler), or when holding a spinlock, or in other
608 * situations where the caller can't schedule(). 616 * situations where the caller can't schedule().
@@ -640,6 +648,10 @@ EXPORT_SYMBOL_GPL(usb_kill_urb);
640 * with error -EPERM. Thus even if the URB's completion handler always 648 * with error -EPERM. Thus even if the URB's completion handler always
641 * tries to resubmit, it will not succeed and the URB will become idle. 649 * tries to resubmit, it will not succeed and the URB will become idle.
642 * 650 *
651 * The URB must not be deallocated while this routine is running. In
652 * particular, when a driver calls this routine, it must insure that the
653 * completion handler cannot deallocate the URB.
654 *
643 * This routine may not be used in an interrupt context (such as a bottom 655 * This routine may not be used in an interrupt context (such as a bottom
644 * half or a completion handler), or when holding a spinlock, or in other 656 * half or a completion handler), or when holding a spinlock, or in other
645 * situations where the caller can't schedule(). 657 * situations where the caller can't schedule().
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 8793f32bab11..e58b16442971 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1574,7 +1574,6 @@ static void destroy_ep_files (struct dev_data *dev)
1574 DBG (dev, "%s %d\n", __func__, dev->state); 1574 DBG (dev, "%s %d\n", __func__, dev->state);
1575 1575
1576 /* dev->state must prevent interference */ 1576 /* dev->state must prevent interference */
1577restart:
1578 spin_lock_irq (&dev->lock); 1577 spin_lock_irq (&dev->lock);
1579 while (!list_empty(&dev->epfiles)) { 1578 while (!list_empty(&dev->epfiles)) {
1580 struct ep_data *ep; 1579 struct ep_data *ep;
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
index c18538e4a6db..2653e73db623 100644
--- a/drivers/usb/storage/usb.c
+++ b/drivers/usb/storage/usb.c
@@ -132,6 +132,35 @@ static struct us_unusual_dev for_dynamic_ids =
132#undef COMPLIANT_DEV 132#undef COMPLIANT_DEV
133#undef USUAL_DEV 133#undef USUAL_DEV
134 134
135#ifdef CONFIG_LOCKDEP
136
137static struct lock_class_key us_interface_key[USB_MAXINTERFACES];
138
139static void us_set_lock_class(struct mutex *mutex,
140 struct usb_interface *intf)
141{
142 struct usb_device *udev = interface_to_usbdev(intf);
143 struct usb_host_config *config = udev->actconfig;
144 int i;
145
146 for (i = 0; i < config->desc.bNumInterfaces; i++) {
147 if (config->interface[i] == intf)
148 break;
149 }
150
151 BUG_ON(i == config->desc.bNumInterfaces);
152
153 lockdep_set_class(mutex, &us_interface_key[i]);
154}
155
156#else
157
158static void us_set_lock_class(struct mutex *mutex,
159 struct usb_interface *intf)
160{
161}
162
163#endif
135 164
136#ifdef CONFIG_PM /* Minimal support for suspend and resume */ 165#ifdef CONFIG_PM /* Minimal support for suspend and resume */
137 166
@@ -895,6 +924,7 @@ int usb_stor_probe1(struct us_data **pus,
895 *pus = us = host_to_us(host); 924 *pus = us = host_to_us(host);
896 memset(us, 0, sizeof(struct us_data)); 925 memset(us, 0, sizeof(struct us_data));
897 mutex_init(&(us->dev_mutex)); 926 mutex_init(&(us->dev_mutex));
927 us_set_lock_class(&us->dev_mutex, intf);
898 init_completion(&us->cmnd_ready); 928 init_completion(&us->cmnd_ready);
899 init_completion(&(us->notify)); 929 init_completion(&(us->notify));
900 init_waitqueue_head(&us->delay_wait); 930 init_waitqueue_head(&us->delay_wait);