diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-12 18:37:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-12 18:37:21 -0400 |
commit | 7c427f45503f77f148cc2b66864e0684c60fa3a0 (patch) | |
tree | 5cd354211d9b926bc16dcf0a02e21911e6d46039 /drivers | |
parent | f4f9c1ac78c5c20150f03c370c2bd7eca44f5127 (diff) | |
parent | 9de29225bdd25958c1fa82521ff02726f1cab953 (diff) |
Merge tag 'usb-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH:
"Here are a number of fixes for the USB core and drivers for 3.4-rc2
Lots of tiny xhci fixes here, a few usb-serial driver fixes and new
device ids, and a smattering of other minor fixes in different USB
drivers.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"
* tag 'usb-3.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (30 commits)
USB: update usbtmc api documentation
xHCI: Correct the #define XHCI_LEGACY_DISABLE_SMI
xHCI: use gfp flags from caller instead of GFP_ATOMIC
xHCI: add XHCI_RESET_ON_RESUME quirk for VIA xHCI host
USB: fix bug of device descriptor got from superspeed device
xhci: Fix register save/restore order.
xhci: Restore event ring dequeue pointer on resume.
xhci: Don't write zeroed pointers to xHC registers.
xhci: Warn when hosts don't halt.
xhci: don't re-enable IE constantly
usb: xhci: fix section mismatch in linux-next
xHCI: correct to print the true HSEE of USBCMD
USB: serial: fix race between probe and open
UHCI: hub_status_data should indicate if ports are resuming
EHCI: keep track of ports being resumed and indicate in hub_status_data
USB: fix race between root-hub suspend and remote wakeup
USB: sierra: add support for Sierra Wireless MC7710
USB: ftdi_sio: fix race condition in TIOCMIWAIT, and abort of TIOCMIWAIT when the device is removed
USB: ftdi_sio: fix status line change handling for TIOCMIWAIT and TIOCGICOUNT
USB: don't ignore suspend errors for root hubs
...
Diffstat (limited to 'drivers')
28 files changed, 184 insertions, 100 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 | ||
5 | menuconfig 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 |
14 | config USB_ARCH_HAS_OHCI | 6 | config 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 | ||
58 | menuconfig 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 | |||
66 | if USB_SUPPORT | 66 | if USB_SUPPORT |
67 | 67 | ||
68 | config USB_COMMON | 68 | config USB_COMMON |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index f8e2d6d52e5c..9a56635dc19c 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1189,8 +1189,13 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg) | |||
1189 | if (status == 0) { | 1189 | if (status == 0) { |
1190 | status = usb_suspend_device(udev, msg); | 1190 | status = usb_suspend_device(udev, msg); |
1191 | 1191 | ||
1192 | /* Again, ignore errors during system sleep transitions */ | 1192 | /* |
1193 | if (!PMSG_IS_AUTO(msg)) | 1193 | * Ignore errors from non-root-hub devices during |
1194 | * system sleep transitions. For the most part, | ||
1195 | * these devices should go to low power anyway when | ||
1196 | * the entire bus is suspended. | ||
1197 | */ | ||
1198 | if (udev->parent && !PMSG_IS_AUTO(msg)) | ||
1194 | status = 0; | 1199 | status = 0; |
1195 | } | 1200 | } |
1196 | 1201 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 9d7fc9a39933..140d3e11f212 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1978,6 +1978,18 @@ int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg) | |||
1978 | if (status == 0) { | 1978 | if (status == 0) { |
1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); | 1979 | usb_set_device_state(rhdev, USB_STATE_SUSPENDED); |
1980 | hcd->state = HC_STATE_SUSPENDED; | 1980 | hcd->state = HC_STATE_SUSPENDED; |
1981 | |||
1982 | /* Did we race with a root-hub wakeup event? */ | ||
1983 | if (rhdev->do_remote_wakeup) { | ||
1984 | char buffer[6]; | ||
1985 | |||
1986 | status = hcd->driver->hub_status_data(hcd, buffer); | ||
1987 | if (status != 0) { | ||
1988 | dev_dbg(&rhdev->dev, "suspend raced with wakeup event\n"); | ||
1989 | hcd_bus_resume(rhdev, PMSG_AUTO_RESUME); | ||
1990 | status = -EBUSY; | ||
1991 | } | ||
1992 | } | ||
1981 | } else { | 1993 | } else { |
1982 | spin_lock_irq(&hcd_root_hub_lock); | 1994 | spin_lock_irq(&hcd_root_hub_lock); |
1983 | if (!HCD_DEAD(hcd)) { | 1995 | if (!HCD_DEAD(hcd)) { |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 28664eb7f555..a2aa9d652c67 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -3163,6 +3163,22 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
3163 | if (retval) | 3163 | if (retval) |
3164 | goto fail; | 3164 | goto fail; |
3165 | 3165 | ||
3166 | /* | ||
3167 | * Some superspeed devices have finished the link training process | ||
3168 | * and attached to a superspeed hub port, but the device descriptor | ||
3169 | * got from those devices show they aren't superspeed devices. Warm | ||
3170 | * reset the port attached by the devices can fix them. | ||
3171 | */ | ||
3172 | if ((udev->speed == USB_SPEED_SUPER) && | ||
3173 | (le16_to_cpu(udev->descriptor.bcdUSB) < 0x0300)) { | ||
3174 | dev_err(&udev->dev, "got a wrong device descriptor, " | ||
3175 | "warm reset device\n"); | ||
3176 | hub_port_reset(hub, port1, udev, | ||
3177 | HUB_BH_RESET_TIME, true); | ||
3178 | retval = -EINVAL; | ||
3179 | goto fail; | ||
3180 | } | ||
3181 | |||
3166 | if (udev->descriptor.bMaxPacketSize0 == 0xff || | 3182 | if (udev->descriptor.bMaxPacketSize0 == 0xff || |
3167 | udev->speed == USB_SPEED_SUPER) | 3183 | udev->speed == USB_SPEED_SUPER) |
3168 | i = 512; | 3184 | i = 512; |
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 */ |
1577 | restart: | ||
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/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 057cdda7a489..806cc95317aa 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -347,6 +347,8 @@ static int ehci_reset (struct ehci_hcd *ehci) | |||
347 | if (ehci->debug) | 347 | if (ehci->debug) |
348 | dbgp_external_startup(); | 348 | dbgp_external_startup(); |
349 | 349 | ||
350 | ehci->port_c_suspend = ehci->suspended_ports = | ||
351 | ehci->resuming_ports = 0; | ||
350 | return retval; | 352 | return retval; |
351 | } | 353 | } |
352 | 354 | ||
@@ -939,6 +941,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
939 | * like usb_port_resume() does. | 941 | * like usb_port_resume() does. |
940 | */ | 942 | */ |
941 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); | 943 | ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); |
944 | set_bit(i, &ehci->resuming_ports); | ||
942 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 945 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
943 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); | 946 | mod_timer(&hcd->rh_timer, ehci->reset_done[i]); |
944 | } | 947 | } |
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c index 256fbd42e48c..38fe07623152 100644 --- a/drivers/usb/host/ehci-hub.c +++ b/drivers/usb/host/ehci-hub.c | |||
@@ -223,15 +223,10 @@ static int ehci_bus_suspend (struct usb_hcd *hcd) | |||
223 | * remote wakeup, we must fail the suspend. | 223 | * remote wakeup, we must fail the suspend. |
224 | */ | 224 | */ |
225 | if (hcd->self.root_hub->do_remote_wakeup) { | 225 | if (hcd->self.root_hub->do_remote_wakeup) { |
226 | port = HCS_N_PORTS(ehci->hcs_params); | 226 | if (ehci->resuming_ports) { |
227 | while (port--) { | 227 | spin_unlock_irq(&ehci->lock); |
228 | if (ehci->reset_done[port] != 0) { | 228 | ehci_dbg(ehci, "suspend failed because a port is resuming\n"); |
229 | spin_unlock_irq(&ehci->lock); | 229 | return -EBUSY; |
230 | ehci_dbg(ehci, "suspend failed because " | ||
231 | "port %d is resuming\n", | ||
232 | port + 1); | ||
233 | return -EBUSY; | ||
234 | } | ||
235 | } | 230 | } |
236 | } | 231 | } |
237 | 232 | ||
@@ -554,16 +549,12 @@ static int | |||
554 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | 549 | ehci_hub_status_data (struct usb_hcd *hcd, char *buf) |
555 | { | 550 | { |
556 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); | 551 | struct ehci_hcd *ehci = hcd_to_ehci (hcd); |
557 | u32 temp, status = 0; | 552 | u32 temp, status; |
558 | u32 mask; | 553 | u32 mask; |
559 | int ports, i, retval = 1; | 554 | int ports, i, retval = 1; |
560 | unsigned long flags; | 555 | unsigned long flags; |
561 | u32 ppcd = 0; | 556 | u32 ppcd = 0; |
562 | 557 | ||
563 | /* if !USB_SUSPEND, root hub timers won't get shut down ... */ | ||
564 | if (ehci->rh_state != EHCI_RH_RUNNING) | ||
565 | return 0; | ||
566 | |||
567 | /* init status to no-changes */ | 558 | /* init status to no-changes */ |
568 | buf [0] = 0; | 559 | buf [0] = 0; |
569 | ports = HCS_N_PORTS (ehci->hcs_params); | 560 | ports = HCS_N_PORTS (ehci->hcs_params); |
@@ -572,6 +563,11 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf) | |||
572 | retval++; | 563 | retval++; |
573 | } | 564 | } |
574 | 565 | ||
566 | /* Inform the core about resumes-in-progress by returning | ||
567 | * a non-zero value even if there are no status changes. | ||
568 | */ | ||
569 | status = ehci->resuming_ports; | ||
570 | |||
575 | /* Some boards (mostly VIA?) report bogus overcurrent indications, | 571 | /* Some boards (mostly VIA?) report bogus overcurrent indications, |
576 | * causing massive log spam unless we completely ignore them. It | 572 | * causing massive log spam unless we completely ignore them. It |
577 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is | 573 | * may be relevant that VIA VT8235 controllers, where PORT_POWER is |
@@ -846,6 +842,7 @@ static int ehci_hub_control ( | |||
846 | ehci_writel(ehci, | 842 | ehci_writel(ehci, |
847 | temp & ~(PORT_RWC_BITS | PORT_RESUME), | 843 | temp & ~(PORT_RWC_BITS | PORT_RESUME), |
848 | status_reg); | 844 | status_reg); |
845 | clear_bit(wIndex, &ehci->resuming_ports); | ||
849 | retval = handshake(ehci, status_reg, | 846 | retval = handshake(ehci, status_reg, |
850 | PORT_RESUME, 0, 2000 /* 2msec */); | 847 | PORT_RESUME, 0, 2000 /* 2msec */); |
851 | if (retval != 0) { | 848 | if (retval != 0) { |
@@ -864,6 +861,7 @@ static int ehci_hub_control ( | |||
864 | ehci->reset_done[wIndex])) { | 861 | ehci->reset_done[wIndex])) { |
865 | status |= USB_PORT_STAT_C_RESET << 16; | 862 | status |= USB_PORT_STAT_C_RESET << 16; |
866 | ehci->reset_done [wIndex] = 0; | 863 | ehci->reset_done [wIndex] = 0; |
864 | clear_bit(wIndex, &ehci->resuming_ports); | ||
867 | 865 | ||
868 | /* force reset to complete */ | 866 | /* force reset to complete */ |
869 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), | 867 | ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), |
@@ -884,8 +882,10 @@ static int ehci_hub_control ( | |||
884 | ehci_readl(ehci, status_reg)); | 882 | ehci_readl(ehci, status_reg)); |
885 | } | 883 | } |
886 | 884 | ||
887 | if (!(temp & (PORT_RESUME|PORT_RESET))) | 885 | if (!(temp & (PORT_RESUME|PORT_RESET))) { |
888 | ehci->reset_done[wIndex] = 0; | 886 | ehci->reset_done[wIndex] = 0; |
887 | clear_bit(wIndex, &ehci->resuming_ports); | ||
888 | } | ||
889 | 889 | ||
890 | /* transfer dedicated ports to the companion hc */ | 890 | /* transfer dedicated ports to the companion hc */ |
891 | if ((temp & PORT_CONNECT) && | 891 | if ((temp & PORT_CONNECT) && |
@@ -920,6 +920,7 @@ static int ehci_hub_control ( | |||
920 | status |= USB_PORT_STAT_SUSPEND; | 920 | status |= USB_PORT_STAT_SUSPEND; |
921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { | 921 | } else if (test_bit(wIndex, &ehci->suspended_ports)) { |
922 | clear_bit(wIndex, &ehci->suspended_ports); | 922 | clear_bit(wIndex, &ehci->suspended_ports); |
923 | clear_bit(wIndex, &ehci->resuming_ports); | ||
923 | ehci->reset_done[wIndex] = 0; | 924 | ehci->reset_done[wIndex] = 0; |
924 | if (temp & PORT_PE) | 925 | if (temp & PORT_PE) |
925 | set_bit(wIndex, &ehci->port_c_suspend); | 926 | set_bit(wIndex, &ehci->port_c_suspend); |
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 3de48a2d7955..73544bd440bd 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c | |||
@@ -224,6 +224,7 @@ static int tegra_ehci_hub_control( | |||
224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); | 224 | temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); |
225 | /* start resume signalling */ | 225 | /* start resume signalling */ |
226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); | 226 | ehci_writel(ehci, temp | PORT_RESUME, status_reg); |
227 | set_bit(wIndex-1, &ehci->resuming_ports); | ||
227 | 228 | ||
228 | spin_unlock_irqrestore(&ehci->lock, flags); | 229 | spin_unlock_irqrestore(&ehci->lock, flags); |
229 | msleep(20); | 230 | msleep(20); |
@@ -236,6 +237,7 @@ static int tegra_ehci_hub_control( | |||
236 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); | 237 | pr_err("%s: timeout waiting for SUSPEND\n", __func__); |
237 | 238 | ||
238 | ehci->reset_done[wIndex-1] = 0; | 239 | ehci->reset_done[wIndex-1] = 0; |
240 | clear_bit(wIndex-1, &ehci->resuming_ports); | ||
239 | 241 | ||
240 | tegra->port_resuming = 1; | 242 | tegra->port_resuming = 1; |
241 | goto done; | 243 | goto done; |
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 8f9acbc96fde..2694ed6558d2 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -117,6 +117,8 @@ struct ehci_hcd { /* one per controller */ | |||
117 | the change-suspend feature turned on */ | 117 | the change-suspend feature turned on */ |
118 | unsigned long suspended_ports; /* which ports are | 118 | unsigned long suspended_ports; /* which ports are |
119 | suspended */ | 119 | suspended */ |
120 | unsigned long resuming_ports; /* which ports have | ||
121 | started to resume */ | ||
120 | 122 | ||
121 | /* per-HC memory pools (could be per-bus, but ...) */ | 123 | /* per-HC memory pools (could be per-bus, but ...) */ |
122 | struct dma_pool *qh_pool; /* qh per active urb */ | 124 | struct dma_pool *qh_pool; /* qh per active urb */ |
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 11de5f1be981..32dada8c8b4f 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c | |||
@@ -825,9 +825,13 @@ static void __devinit quirk_usb_handoff_xhci(struct pci_dev *pdev) | |||
825 | } | 825 | } |
826 | } | 826 | } |
827 | 827 | ||
828 | /* Disable any BIOS SMIs */ | 828 | val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); |
829 | writel(XHCI_LEGACY_DISABLE_SMI, | 829 | /* Mask off (turn off) any enabled SMIs */ |
830 | base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | 830 | val &= XHCI_LEGACY_DISABLE_SMI; |
831 | /* Mask all SMI events bits, RW1C */ | ||
832 | val |= XHCI_LEGACY_SMI_EVENTS; | ||
833 | /* Disable any BIOS SMIs and clear all SMI events*/ | ||
834 | writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); | ||
831 | 835 | ||
832 | if (usb_is_intel_switchable_xhci(pdev)) | 836 | if (usb_is_intel_switchable_xhci(pdev)) |
833 | usb_enable_xhci_ports(pdev); | 837 | usb_enable_xhci_ports(pdev); |
diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c index 045cde4cbc3d..768d54295a20 100644 --- a/drivers/usb/host/uhci-hub.c +++ b/drivers/usb/host/uhci-hub.c | |||
@@ -196,11 +196,12 @@ static int uhci_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
196 | status = get_hub_status_data(uhci, buf); | 196 | status = get_hub_status_data(uhci, buf); |
197 | 197 | ||
198 | switch (uhci->rh_state) { | 198 | switch (uhci->rh_state) { |
199 | case UHCI_RH_SUSPENDING: | ||
200 | case UHCI_RH_SUSPENDED: | 199 | case UHCI_RH_SUSPENDED: |
201 | /* if port change, ask to be resumed */ | 200 | /* if port change, ask to be resumed */ |
202 | if (status || uhci->resuming_ports) | 201 | if (status || uhci->resuming_ports) { |
202 | status = 1; | ||
203 | usb_hcd_resume_root_hub(hcd); | 203 | usb_hcd_resume_root_hub(hcd); |
204 | } | ||
204 | break; | 205 | break; |
205 | 206 | ||
206 | case UHCI_RH_AUTO_STOPPED: | 207 | case UHCI_RH_AUTO_STOPPED: |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index e9b0f043455d..4b436f5a4171 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -119,7 +119,7 @@ static void xhci_print_command_reg(struct xhci_hcd *xhci) | |||
119 | xhci_dbg(xhci, " Event Interrupts %s\n", | 119 | xhci_dbg(xhci, " Event Interrupts %s\n", |
120 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 120 | (temp & CMD_EIE) ? "enabled " : "disabled"); |
121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", | 121 | xhci_dbg(xhci, " Host System Error Interrupts %s\n", |
122 | (temp & CMD_EIE) ? "enabled " : "disabled"); | 122 | (temp & CMD_HSEIE) ? "enabled " : "disabled"); |
123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", | 123 | xhci_dbg(xhci, " HC has %sfinished light reset\n", |
124 | (temp & CMD_LRESET) ? "not " : ""); | 124 | (temp & CMD_LRESET) ? "not " : ""); |
125 | } | 125 | } |
diff --git a/drivers/usb/host/xhci-ext-caps.h b/drivers/usb/host/xhci-ext-caps.h index c7f33123d4c0..377f4242dabb 100644 --- a/drivers/usb/host/xhci-ext-caps.h +++ b/drivers/usb/host/xhci-ext-caps.h | |||
@@ -62,8 +62,9 @@ | |||
62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ | 62 | /* USB Legacy Support Control and Status Register - section 7.1.2 */ |
63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ | 63 | /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ |
64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) | 64 | #define XHCI_LEGACY_CONTROL_OFFSET (0x04) |
65 | /* bits 1:2, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ | 65 | /* bits 1:3, 5:12, and 17:19 need to be preserved; bits 21:28 should be zero */ |
66 | #define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) | 66 | #define XHCI_LEGACY_DISABLE_SMI ((0x7 << 1) + (0xff << 5) + (0x7 << 17)) |
67 | #define XHCI_LEGACY_SMI_EVENTS (0x7 << 29) | ||
67 | 68 | ||
68 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ | 69 | /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ |
69 | #define XHCI_L1C (1 << 16) | 70 | #define XHCI_L1C (1 << 16) |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index cae4c6f2845a..68eaa908ac8e 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -1796,11 +1796,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1796 | int i; | 1796 | int i; |
1797 | 1797 | ||
1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ | 1798 | /* Free the Event Ring Segment Table and the actual Event Ring */ |
1799 | if (xhci->ir_set) { | ||
1800 | xhci_writel(xhci, 0, &xhci->ir_set->erst_size); | ||
1801 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_base); | ||
1802 | xhci_write_64(xhci, 0, &xhci->ir_set->erst_dequeue); | ||
1803 | } | ||
1804 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); | 1799 | size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); |
1805 | if (xhci->erst.entries) | 1800 | if (xhci->erst.entries) |
1806 | dma_free_coherent(&pdev->dev, size, | 1801 | dma_free_coherent(&pdev->dev, size, |
@@ -1812,7 +1807,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1812 | xhci->event_ring = NULL; | 1807 | xhci->event_ring = NULL; |
1813 | xhci_dbg(xhci, "Freed event ring\n"); | 1808 | xhci_dbg(xhci, "Freed event ring\n"); |
1814 | 1809 | ||
1815 | xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring); | ||
1816 | if (xhci->cmd_ring) | 1810 | if (xhci->cmd_ring) |
1817 | xhci_ring_free(xhci, xhci->cmd_ring); | 1811 | xhci_ring_free(xhci, xhci->cmd_ring); |
1818 | xhci->cmd_ring = NULL; | 1812 | xhci->cmd_ring = NULL; |
@@ -1841,7 +1835,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) | |||
1841 | xhci->medium_streams_pool = NULL; | 1835 | xhci->medium_streams_pool = NULL; |
1842 | xhci_dbg(xhci, "Freed medium stream array pool\n"); | 1836 | xhci_dbg(xhci, "Freed medium stream array pool\n"); |
1843 | 1837 | ||
1844 | xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr); | ||
1845 | if (xhci->dcbaa) | 1838 | if (xhci->dcbaa) |
1846 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), | 1839 | dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), |
1847 | xhci->dcbaa, xhci->dcbaa->dma); | 1840 | xhci->dcbaa, xhci->dcbaa->dma); |
@@ -2459,6 +2452,8 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
2459 | 2452 | ||
2460 | fail: | 2453 | fail: |
2461 | xhci_warn(xhci, "Couldn't initialize memory\n"); | 2454 | xhci_warn(xhci, "Couldn't initialize memory\n"); |
2455 | xhci_halt(xhci); | ||
2456 | xhci_reset(xhci); | ||
2462 | xhci_mem_cleanup(xhci); | 2457 | xhci_mem_cleanup(xhci); |
2463 | return -ENOMEM; | 2458 | return -ENOMEM; |
2464 | } | 2459 | } |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index ef98b38626fb..7a856a767e77 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -95,6 +95,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
95 | xhci->quirks |= XHCI_RESET_ON_RESUME; | 95 | xhci->quirks |= XHCI_RESET_ON_RESUME; |
96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); | 96 | xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); |
97 | } | 97 | } |
98 | if (pdev->vendor == PCI_VENDOR_ID_VIA) | ||
99 | xhci->quirks |= XHCI_RESET_ON_RESUME; | ||
98 | } | 100 | } |
99 | 101 | ||
100 | /* called during probe() after chip reset completes */ | 102 | /* called during probe() after chip reset completes */ |
@@ -326,7 +328,7 @@ int __init xhci_register_pci(void) | |||
326 | return pci_register_driver(&xhci_pci_driver); | 328 | return pci_register_driver(&xhci_pci_driver); |
327 | } | 329 | } |
328 | 330 | ||
329 | void __exit xhci_unregister_pci(void) | 331 | void xhci_unregister_pci(void) |
330 | { | 332 | { |
331 | pci_unregister_driver(&xhci_pci_driver); | 333 | pci_unregister_driver(&xhci_pci_driver); |
332 | } | 334 | } |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 6bd9d53062eb..3d9422f16a20 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -2417,7 +2417,7 @@ hw_died: | |||
2417 | u32 irq_pending; | 2417 | u32 irq_pending; |
2418 | /* Acknowledge the PCI interrupt */ | 2418 | /* Acknowledge the PCI interrupt */ |
2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 2419 | irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
2420 | irq_pending |= 0x3; | 2420 | irq_pending |= IMAN_IP; |
2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); | 2421 | xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); |
2422 | } | 2422 | } |
2423 | 2423 | ||
@@ -2734,7 +2734,7 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2734 | urb->dev->speed == USB_SPEED_FULL) | 2734 | urb->dev->speed == USB_SPEED_FULL) |
2735 | urb->interval /= 8; | 2735 | urb->interval /= 8; |
2736 | } | 2736 | } |
2737 | return xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 2737 | return xhci_queue_bulk_tx(xhci, mem_flags, urb, slot_id, ep_index); |
2738 | } | 2738 | } |
2739 | 2739 | ||
2740 | /* | 2740 | /* |
@@ -3514,7 +3514,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
3514 | } | 3514 | } |
3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; | 3515 | ep_ring->num_trbs_free_temp = ep_ring->num_trbs_free; |
3516 | 3516 | ||
3517 | return xhci_queue_isoc_tx(xhci, GFP_ATOMIC, urb, slot_id, ep_index); | 3517 | return xhci_queue_isoc_tx(xhci, mem_flags, urb, slot_id, ep_index); |
3518 | } | 3518 | } |
3519 | 3519 | ||
3520 | /**** Command Ring Operations ****/ | 3520 | /**** Command Ring Operations ****/ |
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index e1963d4a430f..36641a7f2371 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -106,6 +106,9 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); | 106 | STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); |
107 | if (!ret) | 107 | if (!ret) |
108 | xhci->xhc_state |= XHCI_STATE_HALTED; | 108 | xhci->xhc_state |= XHCI_STATE_HALTED; |
109 | else | ||
110 | xhci_warn(xhci, "Host not halted after %u microseconds.\n", | ||
111 | XHCI_MAX_HALT_USEC); | ||
109 | return ret; | 112 | return ret; |
110 | } | 113 | } |
111 | 114 | ||
@@ -664,11 +667,11 @@ static void xhci_save_registers(struct xhci_hcd *xhci) | |||
664 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); | 667 | xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); |
665 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); | 668 | xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); |
666 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); | 669 | xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); |
667 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
668 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
669 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); | 670 | xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); |
670 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); | 671 | xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); |
671 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); | 672 | xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); |
673 | xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); | ||
674 | xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); | ||
672 | } | 675 | } |
673 | 676 | ||
674 | static void xhci_restore_registers(struct xhci_hcd *xhci) | 677 | static void xhci_restore_registers(struct xhci_hcd *xhci) |
@@ -677,10 +680,11 @@ static void xhci_restore_registers(struct xhci_hcd *xhci) | |||
677 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); | 680 | xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); |
678 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); | 681 | xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); |
679 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); | 682 | xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); |
680 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
681 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
682 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); | 683 | xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); |
683 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); | 684 | xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); |
685 | xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue); | ||
686 | xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); | ||
687 | xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); | ||
684 | } | 688 | } |
685 | 689 | ||
686 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) | 690 | static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci) |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 91074fdab3eb..3d69c4b2b542 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -205,6 +205,10 @@ struct xhci_op_regs { | |||
205 | #define CMD_PM_INDEX (1 << 11) | 205 | #define CMD_PM_INDEX (1 << 11) |
206 | /* bits 12:31 are reserved (and should be preserved on writes). */ | 206 | /* bits 12:31 are reserved (and should be preserved on writes). */ |
207 | 207 | ||
208 | /* IMAN - Interrupt Management Register */ | ||
209 | #define IMAN_IP (1 << 1) | ||
210 | #define IMAN_IE (1 << 0) | ||
211 | |||
208 | /* USBSTS - USB status - status bitmasks */ | 212 | /* USBSTS - USB status - status bitmasks */ |
209 | /* HC not running - set to 1 when run/stop bit is cleared. */ | 213 | /* HC not running - set to 1 when run/stop bit is cleared. */ |
210 | #define STS_HALT XHCI_STS_HALT | 214 | #define STS_HALT XHCI_STS_HALT |
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c index 7f547dc3a590..ed8adb052ca7 100644 --- a/drivers/usb/serial/bus.c +++ b/drivers/usb/serial/bus.c | |||
@@ -60,8 +60,6 @@ static int usb_serial_device_probe(struct device *dev) | |||
60 | retval = -ENODEV; | 60 | retval = -ENODEV; |
61 | goto exit; | 61 | goto exit; |
62 | } | 62 | } |
63 | if (port->dev_state != PORT_REGISTERING) | ||
64 | goto exit; | ||
65 | 63 | ||
66 | driver = port->serial->type; | 64 | driver = port->serial->type; |
67 | if (driver->port_probe) { | 65 | if (driver->port_probe) { |
@@ -98,9 +96,6 @@ static int usb_serial_device_remove(struct device *dev) | |||
98 | if (!port) | 96 | if (!port) |
99 | return -ENODEV; | 97 | return -ENODEV; |
100 | 98 | ||
101 | if (port->dev_state != PORT_UNREGISTERING) | ||
102 | return retval; | ||
103 | |||
104 | device_remove_file(&port->dev, &dev_attr_port_number); | 99 | device_remove_file(&port->dev, &dev_attr_port_number); |
105 | 100 | ||
106 | driver = port->serial->type; | 101 | driver = port->serial->type; |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ff8605b4b4be..02e7f2d32d52 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -75,7 +75,8 @@ struct ftdi_private { | |||
75 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 75 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
76 | struct async_icount icount; | 76 | struct async_icount icount; |
77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
78 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ | 78 | char prev_status; /* Used for TIOCMIWAIT */ |
79 | bool dev_gone; /* Used to abort TIOCMIWAIT */ | ||
79 | char transmit_empty; /* If transmitter is empty or not */ | 80 | char transmit_empty; /* If transmitter is empty or not */ |
80 | struct usb_serial_port *port; | 81 | struct usb_serial_port *port; |
81 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface | 82 | __u16 interface; /* FT2232C, FT2232H or FT4232H port interface |
@@ -1681,6 +1682,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1681 | init_waitqueue_head(&priv->delta_msr_wait); | 1682 | init_waitqueue_head(&priv->delta_msr_wait); |
1682 | 1683 | ||
1683 | priv->flags = ASYNC_LOW_LATENCY; | 1684 | priv->flags = ASYNC_LOW_LATENCY; |
1685 | priv->dev_gone = false; | ||
1684 | 1686 | ||
1685 | if (quirk && quirk->port_probe) | 1687 | if (quirk && quirk->port_probe) |
1686 | quirk->port_probe(priv); | 1688 | quirk->port_probe(priv); |
@@ -1839,6 +1841,9 @@ static int ftdi_sio_port_remove(struct usb_serial_port *port) | |||
1839 | 1841 | ||
1840 | dbg("%s", __func__); | 1842 | dbg("%s", __func__); |
1841 | 1843 | ||
1844 | priv->dev_gone = true; | ||
1845 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1846 | |||
1842 | remove_sysfs_attrs(port); | 1847 | remove_sysfs_attrs(port); |
1843 | 1848 | ||
1844 | kref_put(&priv->kref, ftdi_sio_priv_release); | 1849 | kref_put(&priv->kref, ftdi_sio_priv_release); |
@@ -1982,17 +1987,19 @@ static int ftdi_process_packet(struct tty_struct *tty, | |||
1982 | N.B. packet may be processed more than once, but differences | 1987 | N.B. packet may be processed more than once, but differences |
1983 | are only processed once. */ | 1988 | are only processed once. */ |
1984 | status = packet[0] & FTDI_STATUS_B0_MASK; | 1989 | status = packet[0] & FTDI_STATUS_B0_MASK; |
1985 | if (status & FTDI_RS0_CTS) | ||
1986 | priv->icount.cts++; | ||
1987 | if (status & FTDI_RS0_DSR) | ||
1988 | priv->icount.dsr++; | ||
1989 | if (status & FTDI_RS0_RI) | ||
1990 | priv->icount.rng++; | ||
1991 | if (status & FTDI_RS0_RLSD) | ||
1992 | priv->icount.dcd++; | ||
1993 | if (status != priv->prev_status) { | 1990 | if (status != priv->prev_status) { |
1994 | priv->diff_status |= status ^ priv->prev_status; | 1991 | char diff_status = status ^ priv->prev_status; |
1995 | wake_up_interruptible(&priv->delta_msr_wait); | 1992 | |
1993 | if (diff_status & FTDI_RS0_CTS) | ||
1994 | priv->icount.cts++; | ||
1995 | if (diff_status & FTDI_RS0_DSR) | ||
1996 | priv->icount.dsr++; | ||
1997 | if (diff_status & FTDI_RS0_RI) | ||
1998 | priv->icount.rng++; | ||
1999 | if (diff_status & FTDI_RS0_RLSD) | ||
2000 | priv->icount.dcd++; | ||
2001 | |||
2002 | wake_up_interruptible_all(&priv->delta_msr_wait); | ||
1996 | priv->prev_status = status; | 2003 | priv->prev_status = status; |
1997 | } | 2004 | } |
1998 | 2005 | ||
@@ -2395,15 +2402,12 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2395 | */ | 2402 | */ |
2396 | case TIOCMIWAIT: | 2403 | case TIOCMIWAIT: |
2397 | cprev = priv->icount; | 2404 | cprev = priv->icount; |
2398 | while (1) { | 2405 | while (!priv->dev_gone) { |
2399 | interruptible_sleep_on(&priv->delta_msr_wait); | 2406 | interruptible_sleep_on(&priv->delta_msr_wait); |
2400 | /* see if a signal did it */ | 2407 | /* see if a signal did it */ |
2401 | if (signal_pending(current)) | 2408 | if (signal_pending(current)) |
2402 | return -ERESTARTSYS; | 2409 | return -ERESTARTSYS; |
2403 | cnow = priv->icount; | 2410 | cnow = priv->icount; |
2404 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | ||
2405 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | ||
2406 | return -EIO; /* no change => error */ | ||
2407 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | 2411 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || |
2408 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | 2412 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || |
2409 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || | 2413 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || |
@@ -2412,7 +2416,7 @@ static int ftdi_ioctl(struct tty_struct *tty, | |||
2412 | } | 2416 | } |
2413 | cprev = cnow; | 2417 | cprev = cnow; |
2414 | } | 2418 | } |
2415 | /* not reached */ | 2419 | return -EIO; |
2416 | break; | 2420 | break; |
2417 | case TIOCSERGETLSR: | 2421 | case TIOCSERGETLSR: |
2418 | return get_lsr_info(port, (struct serial_struct __user *)arg); | 2422 | return get_lsr_info(port, (struct serial_struct __user *)arg); |
diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 6e1622f2a297..08d16e8c002d 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c | |||
@@ -27,8 +27,8 @@ | |||
27 | 27 | ||
28 | /* Product information. */ | 28 | /* Product information. */ |
29 | #define FOCUS_VENDOR_ID 0x0C2E | 29 | #define FOCUS_VENDOR_ID 0x0C2E |
30 | #define FOCUS_PRODUCT_ID 0x0720 | 30 | #define FOCUS_PRODUCT_ID_BI 0x0720 |
31 | #define FOCUS_PRODUCT_ID_UNI 0x0710 | 31 | #define FOCUS_PRODUCT_ID_UNI 0x0700 |
32 | 32 | ||
33 | #define METROUSB_SET_REQUEST_TYPE 0x40 | 33 | #define METROUSB_SET_REQUEST_TYPE 0x40 |
34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 | 34 | #define METROUSB_SET_MODEM_CTRL_REQUEST 10 |
@@ -47,7 +47,7 @@ struct metrousb_private { | |||
47 | 47 | ||
48 | /* Device table list. */ | 48 | /* Device table list. */ |
49 | static struct usb_device_id id_table[] = { | 49 | static struct usb_device_id id_table[] = { |
50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID) }, | 50 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_BI) }, |
51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, | 51 | { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, |
52 | { }, /* Terminating entry. */ | 52 | { }, /* Terminating entry. */ |
53 | }; | 53 | }; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 836cfa9a515f..f4465ccddc35 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -708,6 +708,7 @@ static const struct usb_device_id option_ids[] = { | |||
708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, | 708 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, |
709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, | 709 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, |
710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, | 710 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, |
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, | ||
711 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, | 712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, |
712 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, | 713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, |
713 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, | 714 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) }, |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ff4a174fa5de..a1a9062954c4 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -420,7 +420,7 @@ static void pl2303_set_termios(struct tty_struct *tty, | |||
420 | control = priv->line_control; | 420 | control = priv->line_control; |
421 | if ((cflag & CBAUD) == B0) | 421 | if ((cflag & CBAUD) == B0) |
422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); | 422 | priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); |
423 | else | 423 | else if ((old_termios->c_cflag & CBAUD) == B0) |
424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); | 424 | priv->line_control |= (CONTROL_DTR | CONTROL_RTS); |
425 | if (control != priv->line_control) { | 425 | if (control != priv->line_control) { |
426 | control = priv->line_control; | 426 | control = priv->line_control; |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index f14465a83dd1..fdd5aa2c8d82 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -289,6 +289,7 @@ static const struct usb_device_id id_table[] = { | |||
289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ | 289 | { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ |
290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ | 290 | { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ |
291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | 291 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
292 | { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */ | ||
292 | /* Sierra Wireless C885 */ | 293 | /* Sierra Wireless C885 */ |
293 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | 294 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
294 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ | 295 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 69230f01056a..97355a15bbea 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -1059,6 +1059,12 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1059 | serial->attached = 1; | 1059 | serial->attached = 1; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | /* Avoid race with tty_open and serial_install by setting the | ||
1063 | * disconnected flag and not clearing it until all ports have been | ||
1064 | * registered. | ||
1065 | */ | ||
1066 | serial->disconnected = 1; | ||
1067 | |||
1062 | if (get_free_serial(serial, num_ports, &minor) == NULL) { | 1068 | if (get_free_serial(serial, num_ports, &minor) == NULL) { |
1063 | dev_err(&interface->dev, "No more free serial devices\n"); | 1069 | dev_err(&interface->dev, "No more free serial devices\n"); |
1064 | goto probe_error; | 1070 | goto probe_error; |
@@ -1070,19 +1076,16 @@ int usb_serial_probe(struct usb_interface *interface, | |||
1070 | port = serial->port[i]; | 1076 | port = serial->port[i]; |
1071 | dev_set_name(&port->dev, "ttyUSB%d", port->number); | 1077 | dev_set_name(&port->dev, "ttyUSB%d", port->number); |
1072 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); | 1078 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); |
1073 | port->dev_state = PORT_REGISTERING; | ||
1074 | device_enable_async_suspend(&port->dev); | 1079 | device_enable_async_suspend(&port->dev); |
1075 | 1080 | ||
1076 | retval = device_add(&port->dev); | 1081 | retval = device_add(&port->dev); |
1077 | if (retval) { | 1082 | if (retval) |
1078 | dev_err(&port->dev, "Error registering port device, " | 1083 | dev_err(&port->dev, "Error registering port device, " |
1079 | "continuing\n"); | 1084 | "continuing\n"); |
1080 | port->dev_state = PORT_UNREGISTERED; | ||
1081 | } else { | ||
1082 | port->dev_state = PORT_REGISTERED; | ||
1083 | } | ||
1084 | } | 1085 | } |
1085 | 1086 | ||
1087 | serial->disconnected = 0; | ||
1088 | |||
1086 | usb_serial_console_init(debug, minor); | 1089 | usb_serial_console_init(debug, minor); |
1087 | 1090 | ||
1088 | exit: | 1091 | exit: |
@@ -1124,22 +1127,8 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1124 | } | 1127 | } |
1125 | kill_traffic(port); | 1128 | kill_traffic(port); |
1126 | cancel_work_sync(&port->work); | 1129 | cancel_work_sync(&port->work); |
1127 | if (port->dev_state == PORT_REGISTERED) { | 1130 | if (device_is_registered(&port->dev)) |
1128 | |||
1129 | /* Make sure the port is bound so that the | ||
1130 | * driver's port_remove method is called. | ||
1131 | */ | ||
1132 | if (!port->dev.driver) { | ||
1133 | int rc; | ||
1134 | |||
1135 | port->dev.driver = | ||
1136 | &serial->type->driver; | ||
1137 | rc = device_bind_driver(&port->dev); | ||
1138 | } | ||
1139 | port->dev_state = PORT_UNREGISTERING; | ||
1140 | device_del(&port->dev); | 1131 | device_del(&port->dev); |
1141 | port->dev_state = PORT_UNREGISTERED; | ||
1142 | } | ||
1143 | } | 1132 | } |
1144 | } | 1133 | } |
1145 | serial->type->disconnect(serial); | 1134 | serial->type->disconnect(serial); |
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 | |||
137 | static struct lock_class_key us_interface_key[USB_MAXINTERFACES]; | ||
138 | |||
139 | static 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 | |||
158 | static 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); |