Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
...

+216 -118
+7 -7
Documentation/ABI/stable/sysfs-driver-usb-usbtmc
··· 1 - What: /sys/bus/usb/drivers/usbtmc/devices/*/interface_capabilities 2 - What: /sys/bus/usb/drivers/usbtmc/devices/*/device_capabilities 1 + What: /sys/bus/usb/drivers/usbtmc/*/interface_capabilities 2 + What: /sys/bus/usb/drivers/usbtmc/*/device_capabilities 3 3 Date: August 2008 4 4 Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 5 5 Description: ··· 12 12 The files are read only. 13 13 14 14 15 - What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_interface_capabilities 16 - What: /sys/bus/usb/drivers/usbtmc/devices/*/usb488_device_capabilities 15 + What: /sys/bus/usb/drivers/usbtmc/*/usb488_interface_capabilities 16 + What: /sys/bus/usb/drivers/usbtmc/*/usb488_device_capabilities 17 17 Date: August 2008 18 18 Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 19 19 Description: ··· 27 27 The files are read only. 28 28 29 29 30 - What: /sys/bus/usb/drivers/usbtmc/devices/*/TermChar 30 + What: /sys/bus/usb/drivers/usbtmc/*/TermChar 31 31 Date: August 2008 32 32 Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 33 33 Description: ··· 40 40 sent to the device or not. 41 41 42 42 43 - What: /sys/bus/usb/drivers/usbtmc/devices/*/TermCharEnabled 43 + What: /sys/bus/usb/drivers/usbtmc/*/TermCharEnabled 44 44 Date: August 2008 45 45 Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 46 46 Description: ··· 51 51 published by the USB-IF. 52 52 53 53 54 - What: /sys/bus/usb/drivers/usbtmc/devices/*/auto_abort 54 + What: /sys/bus/usb/drivers/usbtmc/*/auto_abort 55 55 Date: August 2008 56 56 Contact: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 57 57 Description:
+22
Documentation/usb/URB.txt
··· 168 168 they will get a -EPERM error. Thus you can be sure that when 169 169 usb_kill_urb() returns, the URB is totally idle. 170 170 171 + There is a lifetime issue to consider. An URB may complete at any 172 + time, and the completion handler may free the URB. If this happens 173 + while usb_unlink_urb or usb_kill_urb is running, it will cause a 174 + memory-access violation. The driver is responsible for avoiding this, 175 + which often means some sort of lock will be needed to prevent the URB 176 + from being deallocated while it is still in use. 177 + 178 + On the other hand, since usb_unlink_urb may end up calling the 179 + completion handler, the handler must not take any lock that is held 180 + when usb_unlink_urb is invoked. The general solution to this problem 181 + is to increment the URB's reference count while holding the lock, then 182 + drop the lock and call usb_unlink_urb or usb_kill_urb, and then 183 + decrement the URB's reference count. You increment the reference 184 + count by calling 185 + 186 + struct urb *usb_get_urb(struct urb *urb) 187 + 188 + (ignore the return value; it is the same as the argument) and 189 + decrement the reference count by calling usb_free_urb. Of course, 190 + none of this is necessary if there's no danger of the URB being freed 191 + by the completion handler. 192 + 171 193 172 194 1.7. What about the completion handler? 173 195
+3 -3
Documentation/usb/usbmon.txt
··· 183 183 d5ea89a0 3575914555 S Ci:1:001:0 s a3 00 0000 0003 0004 4 < 184 184 d5ea89a0 3575914560 C Ci:1:001:0 0 4 = 01050000 185 185 186 - An output bulk transfer to send a SCSI command 0x5E in a 31-byte Bulk wrapper 187 - to a storage device at address 5: 186 + An output bulk transfer to send a SCSI command 0x28 (READ_10) in a 31-byte 187 + Bulk wrapper to a storage device at address 5: 188 188 189 - dd65f0e8 4128379752 S Bo:1:005:2 -115 31 = 55534243 5e000000 00000000 00000600 00000000 00000000 00000000 000000 189 + dd65f0e8 4128379752 S Bo:1:005:2 -115 31 = 55534243 ad000000 00800000 80010a28 20000000 20000040 00000000 000000 190 190 dd65f0e8 4128379808 C Bo:1:005:2 0 31 > 191 191 192 192 * Raw binary format and API
+8 -8
drivers/usb/Kconfig
··· 2 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 5 # many non-PCI SOC chips embed OHCI 14 6 config USB_ARCH_HAS_OHCI 15 7 boolean ··· 54 62 config USB_ARCH_HAS_XHCI 55 63 boolean 56 64 default PCI 65 + 66 + menuconfig USB_SUPPORT 67 + bool "USB support" 68 + depends on HAS_IOMEM 69 + default y 70 + ---help--- 71 + This option adds core support for Universal Serial Bus (USB). 72 + You will also need drivers from the following menu to make use of it. 57 73 58 74 if USB_SUPPORT 59 75
+7 -2
drivers/usb/core/driver.c
··· 1189 1189 if (status == 0) { 1190 1190 status = usb_suspend_device(udev, msg); 1191 1191 1192 - /* Again, ignore errors during system sleep transitions */ 1193 - if (!PMSG_IS_AUTO(msg)) 1192 + /* 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 1199 status = 0; 1195 1200 } 1196 1201
+12
drivers/usb/core/hcd.c
··· 1978 1978 if (status == 0) { 1979 1979 usb_set_device_state(rhdev, USB_STATE_SUSPENDED); 1980 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 1993 } else { 1982 1994 spin_lock_irq(&hcd_root_hub_lock); 1983 1995 if (!HCD_DEAD(hcd)) {
+16
drivers/usb/core/hub.c
··· 3163 3163 if (retval) 3164 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 3182 if (udev->descriptor.bMaxPacketSize0 == 0xff || 3167 3183 udev->speed == USB_SPEED_SUPER) 3168 3184 i = 512;
+6 -5
drivers/usb/core/message.c
··· 308 308 retval = usb_unlink_urb(io->urbs [i]); 309 309 if (retval != -EINPROGRESS && 310 310 retval != -ENODEV && 311 - retval != -EBUSY) 311 + retval != -EBUSY && 312 + retval != -EIDRM) 312 313 dev_err(&io->dev->dev, 313 314 "%s, unlink --> %d\n", 314 315 __func__, retval); ··· 318 317 } 319 318 spin_lock(&io->lock); 320 319 } 321 - urb->dev = NULL; 322 320 323 321 /* on the last completion, signal usb_sg_wait() */ 324 322 io->bytes += urb->actual_length; ··· 524 524 case -ENXIO: /* hc didn't queue this one */ 525 525 case -EAGAIN: 526 526 case -ENOMEM: 527 - io->urbs[i]->dev = NULL; 528 527 retval = 0; 529 528 yield(); 530 529 break; ··· 541 542 542 543 /* fail any uncompleted urbs */ 543 544 default: 544 - io->urbs[i]->dev = NULL; 545 545 io->urbs[i]->status = retval; 546 546 dev_dbg(&io->dev->dev, "%s, submit --> %d\n", 547 547 __func__, retval); ··· 591 593 if (!io->urbs [i]->dev) 592 594 continue; 593 595 retval = usb_unlink_urb(io->urbs [i]); 594 - if (retval != -EINPROGRESS && retval != -EBUSY) 596 + if (retval != -EINPROGRESS 597 + && retval != -ENODEV 598 + && retval != -EBUSY 599 + && retval != -EIDRM) 595 600 dev_warn(&io->dev->dev, "%s, unlink --> %d\n", 596 601 __func__, retval); 597 602 }
+12
drivers/usb/core/urb.c
··· 539 539 * never submitted, or it was unlinked before, or the hardware is already 540 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 546 * Unlinking and Endpoint Queues: 543 547 * 544 548 * [The behaviors and guarantees described below do not apply to virtual ··· 607 603 * with error -EPERM. Thus even if the URB's completion handler always 608 604 * tries to resubmit, it will not succeed and the URB will become idle. 609 605 * 606 + * The URB must not be deallocated while this routine is running. In 607 + * particular, when a driver calls this routine, it must insure that the 608 + * completion handler cannot deallocate the URB. 609 + * 610 610 * This routine may not be used in an interrupt context (such as a bottom 611 611 * half or a completion handler), or when holding a spinlock, or in other 612 612 * situations where the caller can't schedule(). ··· 647 639 * After and while the routine runs, attempts to resubmit the URB will fail 648 640 * with error -EPERM. Thus even if the URB's completion handler always 649 641 * tries to resubmit, it will not succeed and the URB will become idle. 642 + * 643 + * The URB must not be deallocated while this routine is running. In 644 + * particular, when a driver calls this routine, it must insure that the 645 + * completion handler cannot deallocate the URB. 650 646 * 651 647 * This routine may not be used in an interrupt context (such as a bottom 652 648 * half or a completion handler), or when holding a spinlock, or in other
-1
drivers/usb/gadget/inode.c
··· 1574 1574 DBG (dev, "%s %d\n", __func__, dev->state); 1575 1575 1576 1576 /* dev->state must prevent interference */ 1577 - restart: 1578 1577 spin_lock_irq (&dev->lock); 1579 1578 while (!list_empty(&dev->epfiles)) { 1580 1579 struct ep_data *ep;
+3
drivers/usb/host/ehci-hcd.c
··· 347 347 if (ehci->debug) 348 348 dbgp_external_startup(); 349 349 350 + ehci->port_c_suspend = ehci->suspended_ports = 351 + ehci->resuming_ports = 0; 350 352 return retval; 351 353 } 352 354 ··· 941 939 * like usb_port_resume() does. 942 940 */ 943 941 ehci->reset_done[i] = jiffies + msecs_to_jiffies(25); 942 + set_bit(i, &ehci->resuming_ports); 944 943 ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); 945 944 mod_timer(&hcd->rh_timer, ehci->reset_done[i]); 946 945 }
+16 -15
drivers/usb/host/ehci-hub.c
··· 223 223 * remote wakeup, we must fail the suspend. 224 224 */ 225 225 if (hcd->self.root_hub->do_remote_wakeup) { 226 - port = HCS_N_PORTS(ehci->hcs_params); 227 - while (port--) { 228 - if (ehci->reset_done[port] != 0) { 229 - spin_unlock_irq(&ehci->lock); 230 - ehci_dbg(ehci, "suspend failed because " 231 - "port %d is resuming\n", 232 - port + 1); 233 - return -EBUSY; 234 - } 226 + if (ehci->resuming_ports) { 227 + spin_unlock_irq(&ehci->lock); 228 + ehci_dbg(ehci, "suspend failed because a port is resuming\n"); 229 + return -EBUSY; 235 230 } 236 231 } 237 232 ··· 549 554 ehci_hub_status_data (struct usb_hcd *hcd, char *buf) 550 555 { 551 556 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 552 - u32 temp, status = 0; 557 + u32 temp, status; 553 558 u32 mask; 554 559 int ports, i, retval = 1; 555 560 unsigned long flags; 556 561 u32 ppcd = 0; 557 - 558 - /* if !USB_SUSPEND, root hub timers won't get shut down ... */ 559 - if (ehci->rh_state != EHCI_RH_RUNNING) 560 - return 0; 561 562 562 563 /* init status to no-changes */ 563 564 buf [0] = 0; ··· 562 571 buf [1] = 0; 563 572 retval++; 564 573 } 574 + 575 + /* Inform the core about resumes-in-progress by returning 576 + * a non-zero value even if there are no status changes. 577 + */ 578 + status = ehci->resuming_ports; 565 579 566 580 /* Some boards (mostly VIA?) report bogus overcurrent indications, 567 581 * causing massive log spam unless we completely ignore them. It ··· 842 846 ehci_writel(ehci, 843 847 temp & ~(PORT_RWC_BITS | PORT_RESUME), 844 848 status_reg); 849 + clear_bit(wIndex, &ehci->resuming_ports); 845 850 retval = handshake(ehci, status_reg, 846 851 PORT_RESUME, 0, 2000 /* 2msec */); 847 852 if (retval != 0) { ··· 861 864 ehci->reset_done[wIndex])) { 862 865 status |= USB_PORT_STAT_C_RESET << 16; 863 866 ehci->reset_done [wIndex] = 0; 867 + clear_bit(wIndex, &ehci->resuming_ports); 864 868 865 869 /* force reset to complete */ 866 870 ehci_writel(ehci, temp & ~(PORT_RWC_BITS | PORT_RESET), ··· 882 884 ehci_readl(ehci, status_reg)); 883 885 } 884 886 885 - if (!(temp & (PORT_RESUME|PORT_RESET))) 887 + if (!(temp & (PORT_RESUME|PORT_RESET))) { 886 888 ehci->reset_done[wIndex] = 0; 889 + clear_bit(wIndex, &ehci->resuming_ports); 890 + } 887 891 888 892 /* transfer dedicated ports to the companion hc */ 889 893 if ((temp & PORT_CONNECT) && ··· 920 920 status |= USB_PORT_STAT_SUSPEND; 921 921 } else if (test_bit(wIndex, &ehci->suspended_ports)) { 922 922 clear_bit(wIndex, &ehci->suspended_ports); 923 + clear_bit(wIndex, &ehci->resuming_ports); 923 924 ehci->reset_done[wIndex] = 0; 924 925 if (temp & PORT_PE) 925 926 set_bit(wIndex, &ehci->port_c_suspend);
+2
drivers/usb/host/ehci-tegra.c
··· 224 224 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); 225 225 /* start resume signalling */ 226 226 ehci_writel(ehci, temp | PORT_RESUME, status_reg); 227 + set_bit(wIndex-1, &ehci->resuming_ports); 227 228 228 229 spin_unlock_irqrestore(&ehci->lock, flags); 229 230 msleep(20); ··· 237 236 pr_err("%s: timeout waiting for SUSPEND\n", __func__); 238 237 239 238 ehci->reset_done[wIndex-1] = 0; 239 + clear_bit(wIndex-1, &ehci->resuming_ports); 240 240 241 241 tegra->port_resuming = 1; 242 242 goto done;
+2
drivers/usb/host/ehci.h
··· 117 117 the change-suspend feature turned on */ 118 118 unsigned long suspended_ports; /* which ports are 119 119 suspended */ 120 + unsigned long resuming_ports; /* which ports have 121 + started to resume */ 120 122 121 123 /* per-HC memory pools (could be per-bus, but ...) */ 122 124 struct dma_pool *qh_pool; /* qh per active urb */
+7 -3
drivers/usb/host/pci-quirks.c
··· 825 825 } 826 826 } 827 827 828 - /* Disable any BIOS SMIs */ 829 - writel(XHCI_LEGACY_DISABLE_SMI, 830 - base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); 828 + val = readl(base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET); 829 + /* Mask off (turn off) any enabled SMIs */ 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 836 if (usb_is_intel_switchable_xhci(pdev)) 833 837 usb_enable_xhci_ports(pdev);
+3 -2
drivers/usb/host/uhci-hub.c
··· 196 196 status = get_hub_status_data(uhci, buf); 197 197 198 198 switch (uhci->rh_state) { 199 - case UHCI_RH_SUSPENDING: 200 199 case UHCI_RH_SUSPENDED: 201 200 /* if port change, ask to be resumed */ 202 - if (status || uhci->resuming_ports) 201 + if (status || uhci->resuming_ports) { 202 + status = 1; 203 203 usb_hcd_resume_root_hub(hcd); 204 + } 204 205 break; 205 206 206 207 case UHCI_RH_AUTO_STOPPED:
+1 -1
drivers/usb/host/xhci-dbg.c
··· 119 119 xhci_dbg(xhci, " Event Interrupts %s\n", 120 120 (temp & CMD_EIE) ? "enabled " : "disabled"); 121 121 xhci_dbg(xhci, " Host System Error Interrupts %s\n", 122 - (temp & CMD_EIE) ? "enabled " : "disabled"); 122 + (temp & CMD_HSEIE) ? "enabled " : "disabled"); 123 123 xhci_dbg(xhci, " HC has %sfinished light reset\n", 124 124 (temp & CMD_LRESET) ? "not " : ""); 125 125 }
+3 -2
drivers/usb/host/xhci-ext-caps.h
··· 62 62 /* USB Legacy Support Control and Status Register - section 7.1.2 */ 63 63 /* Add this offset, plus the value of xECP in HCCPARAMS to the base address */ 64 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 */ 66 - #define XHCI_LEGACY_DISABLE_SMI ((0x3 << 1) + (0xff << 5) + (0x7 << 17)) 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 ((0x7 << 1) + (0xff << 5) + (0x7 << 17)) 67 + #define XHCI_LEGACY_SMI_EVENTS (0x7 << 29) 67 68 68 69 /* USB 2.0 xHCI 0.96 L1C capability - section 7.2.2.1.3.2 */ 69 70 #define XHCI_L1C (1 << 16)
+2 -7
drivers/usb/host/xhci-mem.c
··· 1796 1796 int i; 1797 1797 1798 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 1799 size = sizeof(struct xhci_erst_entry)*(xhci->erst.num_entries); 1805 1800 if (xhci->erst.entries) 1806 1801 dma_free_coherent(&pdev->dev, size, ··· 1807 1812 xhci->event_ring = NULL; 1808 1813 xhci_dbg(xhci, "Freed event ring\n"); 1809 1814 1810 - xhci_write_64(xhci, 0, &xhci->op_regs->cmd_ring); 1811 1815 if (xhci->cmd_ring) 1812 1816 xhci_ring_free(xhci, xhci->cmd_ring); 1813 1817 xhci->cmd_ring = NULL; ··· 1835 1841 xhci->medium_streams_pool = NULL; 1836 1842 xhci_dbg(xhci, "Freed medium stream array pool\n"); 1837 1843 1838 - xhci_write_64(xhci, 0, &xhci->op_regs->dcbaa_ptr); 1839 1844 if (xhci->dcbaa) 1840 1845 dma_free_coherent(&pdev->dev, sizeof(*xhci->dcbaa), 1841 1846 xhci->dcbaa, xhci->dcbaa->dma); ··· 2452 2459 2453 2460 fail: 2454 2461 xhci_warn(xhci, "Couldn't initialize memory\n"); 2462 + xhci_halt(xhci); 2463 + xhci_reset(xhci); 2455 2464 xhci_mem_cleanup(xhci); 2456 2465 return -ENOMEM; 2457 2466 }
+3 -1
drivers/usb/host/xhci-pci.c
··· 95 95 xhci->quirks |= XHCI_RESET_ON_RESUME; 96 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 102 /* called during probe() after chip reset completes */ ··· 328 326 return pci_register_driver(&xhci_pci_driver); 329 327 } 330 328 331 - void __exit xhci_unregister_pci(void) 329 + void xhci_unregister_pci(void) 332 330 { 333 331 pci_unregister_driver(&xhci_pci_driver); 334 332 }
+3 -3
drivers/usb/host/xhci-ring.c
··· 2417 2417 u32 irq_pending; 2418 2418 /* Acknowledge the PCI interrupt */ 2419 2419 irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); 2420 - irq_pending |= 0x3; 2420 + irq_pending |= IMAN_IP; 2421 2421 xhci_writel(xhci, irq_pending, &xhci->ir_set->irq_pending); 2422 2422 } 2423 2423 ··· 2734 2734 urb->dev->speed == USB_SPEED_FULL) 2735 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 3514 } 3515 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 3520 /**** Command Ring Operations ****/
+8 -4
drivers/usb/host/xhci.c
··· 106 106 STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC); 107 107 if (!ret) 108 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 112 return ret; 110 113 } 111 114 ··· 667 664 xhci->s3.dev_nt = xhci_readl(xhci, &xhci->op_regs->dev_notification); 668 665 xhci->s3.dcbaa_ptr = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); 669 666 xhci->s3.config_reg = xhci_readl(xhci, &xhci->op_regs->config_reg); 670 - xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); 671 - xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); 672 667 xhci->s3.erst_size = xhci_readl(xhci, &xhci->ir_set->erst_size); 673 668 xhci->s3.erst_base = xhci_read_64(xhci, &xhci->ir_set->erst_base); 674 669 xhci->s3.erst_dequeue = xhci_read_64(xhci, &xhci->ir_set->erst_dequeue); 670 + xhci->s3.irq_pending = xhci_readl(xhci, &xhci->ir_set->irq_pending); 671 + xhci->s3.irq_control = xhci_readl(xhci, &xhci->ir_set->irq_control); 675 672 } 676 673 677 674 static void xhci_restore_registers(struct xhci_hcd *xhci) ··· 680 677 xhci_writel(xhci, xhci->s3.dev_nt, &xhci->op_regs->dev_notification); 681 678 xhci_write_64(xhci, xhci->s3.dcbaa_ptr, &xhci->op_regs->dcbaa_ptr); 682 679 xhci_writel(xhci, xhci->s3.config_reg, &xhci->op_regs->config_reg); 683 - xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); 684 - xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); 685 680 xhci_writel(xhci, xhci->s3.erst_size, &xhci->ir_set->erst_size); 686 681 xhci_write_64(xhci, xhci->s3.erst_base, &xhci->ir_set->erst_base); 682 + xhci_write_64(xhci, xhci->s3.erst_dequeue, &xhci->ir_set->erst_dequeue); 683 + xhci_writel(xhci, xhci->s3.irq_pending, &xhci->ir_set->irq_pending); 684 + xhci_writel(xhci, xhci->s3.irq_control, &xhci->ir_set->irq_control); 687 685 } 688 686 689 687 static void xhci_set_cmd_ring_deq(struct xhci_hcd *xhci)
+4
drivers/usb/host/xhci.h
··· 205 205 #define CMD_PM_INDEX (1 << 11) 206 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 212 /* USBSTS - USB status - status bitmasks */ 209 213 /* HC not running - set to 1 when run/stop bit is cleared. */ 210 214 #define STS_HALT XHCI_STS_HALT
-5
drivers/usb/serial/bus.c
··· 60 60 retval = -ENODEV; 61 61 goto exit; 62 62 } 63 - if (port->dev_state != PORT_REGISTERING) 64 - goto exit; 65 63 66 64 driver = port->serial->type; 67 65 if (driver->port_probe) { ··· 95 97 port = to_usb_serial_port(dev); 96 98 if (!port) 97 99 return -ENODEV; 98 - 99 - if (port->dev_state != PORT_UNREGISTERING) 100 - return retval; 101 100 102 101 device_remove_file(&port->dev, &dev_attr_port_number); 103 102
+20 -16
drivers/usb/serial/ftdi_sio.c
··· 75 75 unsigned long last_dtr_rts; /* saved modem control outputs */ 76 76 struct async_icount icount; 77 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 80 char transmit_empty; /* If transmitter is empty or not */ 80 81 struct usb_serial_port *port; 81 82 __u16 interface; /* FT2232C, FT2232H or FT4232H port interface ··· 1682 1681 init_waitqueue_head(&priv->delta_msr_wait); 1683 1682 1684 1683 priv->flags = ASYNC_LOW_LATENCY; 1684 + priv->dev_gone = false; 1685 1685 1686 1686 if (quirk && quirk->port_probe) 1687 1687 quirk->port_probe(priv); ··· 1841 1839 1842 1840 dbg("%s", __func__); 1843 1841 1842 + priv->dev_gone = true; 1843 + wake_up_interruptible_all(&priv->delta_msr_wait); 1844 + 1844 1845 remove_sysfs_attrs(port); 1845 1846 1846 1847 kref_put(&priv->kref, ftdi_sio_priv_release); ··· 1987 1982 N.B. packet may be processed more than once, but differences 1988 1983 are only processed once. */ 1989 1984 status = packet[0] & FTDI_STATUS_B0_MASK; 1990 - if (status & FTDI_RS0_CTS) 1991 - priv->icount.cts++; 1992 - if (status & FTDI_RS0_DSR) 1993 - priv->icount.dsr++; 1994 - if (status & FTDI_RS0_RI) 1995 - priv->icount.rng++; 1996 - if (status & FTDI_RS0_RLSD) 1997 - priv->icount.dcd++; 1998 1985 if (status != priv->prev_status) { 1999 - priv->diff_status |= status ^ priv->prev_status; 2000 - wake_up_interruptible(&priv->delta_msr_wait); 1986 + char diff_status = status ^ priv->prev_status; 1987 + 1988 + if (diff_status & FTDI_RS0_CTS) 1989 + priv->icount.cts++; 1990 + if (diff_status & FTDI_RS0_DSR) 1991 + priv->icount.dsr++; 1992 + if (diff_status & FTDI_RS0_RI) 1993 + priv->icount.rng++; 1994 + if (diff_status & FTDI_RS0_RLSD) 1995 + priv->icount.dcd++; 1996 + 1997 + wake_up_interruptible_all(&priv->delta_msr_wait); 2001 1998 priv->prev_status = status; 2002 1999 } 2003 2000 ··· 2402 2395 */ 2403 2396 case TIOCMIWAIT: 2404 2397 cprev = priv->icount; 2405 - while (1) { 2398 + while (!priv->dev_gone) { 2406 2399 interruptible_sleep_on(&priv->delta_msr_wait); 2407 2400 /* see if a signal did it */ 2408 2401 if (signal_pending(current)) 2409 2402 return -ERESTARTSYS; 2410 2403 cnow = priv->icount; 2411 - if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && 2412 - cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) 2413 - return -EIO; /* no change => error */ 2414 2404 if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || 2415 2405 ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || 2416 2406 ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || ··· 2416 2412 } 2417 2413 cprev = cnow; 2418 2414 } 2419 - /* not reached */ 2415 + return -EIO; 2420 2416 break; 2421 2417 case TIOCSERGETLSR: 2422 2418 return get_lsr_info(port, (struct serial_struct __user *)arg);
+3 -3
drivers/usb/serial/metro-usb.c
··· 27 27 28 28 /* Product information. */ 29 29 #define FOCUS_VENDOR_ID 0x0C2E 30 - #define FOCUS_PRODUCT_ID 0x0720 31 - #define FOCUS_PRODUCT_ID_UNI 0x0710 30 + #define FOCUS_PRODUCT_ID_BI 0x0720 31 + #define FOCUS_PRODUCT_ID_UNI 0x0700 32 32 33 33 #define METROUSB_SET_REQUEST_TYPE 0x40 34 34 #define METROUSB_SET_MODEM_CTRL_REQUEST 10 ··· 47 47 48 48 /* Device table list. */ 49 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 51 { USB_DEVICE(FOCUS_VENDOR_ID, FOCUS_PRODUCT_ID_UNI) }, 52 52 { }, /* Terminating entry. */ 53 53 };
+1
drivers/usb/serial/option.c
··· 708 708 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, 709 709 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, 710 710 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, 711 + { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, 711 712 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED3) }, 712 713 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED4) }, 713 714 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED5) },
+1 -1
drivers/usb/serial/pl2303.c
··· 420 420 control = priv->line_control; 421 421 if ((cflag & CBAUD) == B0) 422 422 priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS); 423 - else 423 + else if ((old_termios->c_cflag & CBAUD) == B0) 424 424 priv->line_control |= (CONTROL_DTR | CONTROL_RTS); 425 425 if (control != priv->line_control) { 426 426 control = priv->line_control;
+1
drivers/usb/serial/sierra.c
··· 289 289 { USB_DEVICE(0x1199, 0x6856) }, /* Sierra Wireless AirCard 881 U */ 290 290 { USB_DEVICE(0x1199, 0x6859) }, /* Sierra Wireless AirCard 885 E */ 291 291 { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ 292 + { USB_DEVICE(0x1199, 0x68A2) }, /* Sierra Wireless MC7710 */ 292 293 /* Sierra Wireless C885 */ 293 294 { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, 294 295 /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */
+10 -21
drivers/usb/serial/usb-serial.c
··· 1059 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 1068 if (get_free_serial(serial, num_ports, &minor) == NULL) { 1063 1069 dev_err(&interface->dev, "No more free serial devices\n"); 1064 1070 goto probe_error; ··· 1076 1070 port = serial->port[i]; 1077 1071 dev_set_name(&port->dev, "ttyUSB%d", port->number); 1078 1072 dbg ("%s - registering %s", __func__, dev_name(&port->dev)); 1079 - port->dev_state = PORT_REGISTERING; 1080 1073 device_enable_async_suspend(&port->dev); 1081 1074 1082 1075 retval = device_add(&port->dev); 1083 - if (retval) { 1076 + if (retval) 1084 1077 dev_err(&port->dev, "Error registering port device, " 1085 1078 "continuing\n"); 1086 - port->dev_state = PORT_UNREGISTERED; 1087 - } else { 1088 - port->dev_state = PORT_REGISTERED; 1089 - } 1090 1079 } 1080 + 1081 + serial->disconnected = 0; 1091 1082 1092 1083 usb_serial_console_init(debug, minor); 1093 1084 ··· 1127 1124 } 1128 1125 kill_traffic(port); 1129 1126 cancel_work_sync(&port->work); 1130 - if (port->dev_state == PORT_REGISTERED) { 1131 - 1132 - /* Make sure the port is bound so that the 1133 - * driver's port_remove method is called. 1134 - */ 1135 - if (!port->dev.driver) { 1136 - int rc; 1137 - 1138 - port->dev.driver = 1139 - &serial->type->driver; 1140 - rc = device_bind_driver(&port->dev); 1141 - } 1142 - port->dev_state = PORT_UNREGISTERING; 1127 + if (device_is_registered(&port->dev)) 1143 1128 device_del(&port->dev); 1144 - port->dev_state = PORT_UNREGISTERED; 1145 - } 1146 1129 } 1147 1130 } 1148 1131 serial->type->disconnect(serial);
+30
drivers/usb/storage/usb.c
··· 132 132 #undef COMPLIANT_DEV 133 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 165 #ifdef CONFIG_PM /* Minimal support for suspend and resume */ 137 166 ··· 924 895 *pus = us = host_to_us(host); 925 896 memset(us, 0, sizeof(struct us_data)); 926 897 mutex_init(&(us->dev_mutex)); 898 + us_set_lock_class(&us->dev_mutex, intf); 927 899 init_completion(&us->cmnd_ready); 928 900 init_completion(&(us->notify)); 929 901 init_waitqueue_head(&us->delay_wait);
-8
include/linux/usb/serial.h
··· 28 28 /* parity check flag */ 29 29 #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) 30 30 31 - enum port_dev_state { 32 - PORT_UNREGISTERED, 33 - PORT_REGISTERING, 34 - PORT_REGISTERED, 35 - PORT_UNREGISTERING, 36 - }; 37 - 38 31 /* USB serial flags */ 39 32 #define USB_SERIAL_WRITE_BUSY 0 40 33 ··· 117 124 char throttle_req; 118 125 unsigned long sysrq; /* sysrq timeout */ 119 126 struct device dev; 120 - enum port_dev_state dev_state; 121 127 }; 122 128 #define to_usb_serial_port(d) container_of(d, struct usb_serial_port, dev) 123 129