1. 23 9月, 2015 1 次提交
  2. 19 8月, 2015 2 次提交
  3. 15 8月, 2015 2 次提交
  4. 23 7月, 2015 2 次提交
    • K
      usb: move assignment out of if condition · 0faaad46
      Kris Borer 提交于
      Fix four occurrences of checkpatch.pl error:
      
      ERROR: do not use assignment in if condition
      
      The semantic patch that makes this change is:
      
      // <smpl>
      @@
      identifier i;
      expression E;
      statement S;
      constant c;
      binary operator b;
      @@
      
      + i = E;
        if (
      - (i = E)
      + i
        b
        c ) S
      
      @@
      identifier i, i2;
      expression E1, E2;
      constant c;
      @@
      
      + if( E1->i ) {
      +  	i2 = E2;
      + 	if (i2 < c) {
      - if( E1->i && (i2 = E2) < c ) {
        ...
      - }
      + 	}
      + }
      // </smpl>
      Signed-off-by: NKris Borer <kborer@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0faaad46
    • L
      usb: core: lpm: set lpm_capable for root hub device · 2d2a3167
      Lu Baolu 提交于
      Commit 25cd2882 ("usb/xhci: Change how we indicate a host supports
      Link PM.") removed the code to set lpm_capable for USB 3.0 super-speed
      root hub. The intention of that change was to avoid touching usb core
      internal field, a.k.a. lpm_capable, and let usb core to set it by
      checking U1 and U2 exit latency values in the descriptor.
      
      Usb core checks and sets lpm_capable in hub_port_init(). Unfortunately,
      root hub is a special usb device as it has no parent. Hub_port_init()
      will never be called for a root hub device. That means lpm_capable will
      by no means be set for the root hub. As the result, lpm isn't functional
      at all in Linux kernel.
      
      This patch add the code to check and set lpm_capable when registering a
      root hub device. It could be back-ported to kernels as old as v3.15,
      that contains the Commit 25cd2882 ("usb/xhci: Change how we indicate
      a host supports Link PM.").
      
      Cc: stable@vger.kernel.org # 3.15
      Reported-by: NKevin Strasser <kevin.strasser@linux.intel.com>
      Signed-off-by: NLu Baolu <baolu.lu@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2d2a3167
  5. 10 5月, 2015 1 次提交
  6. 01 2月, 2015 1 次提交
  7. 04 12月, 2014 1 次提交
  8. 04 11月, 2014 2 次提交
    • H
      usb: Do not allow usb_alloc_streams on unconfigured devices · 90a646c7
      Hans de Goede 提交于
      This commit fixes the following oops:
      
      [10238.622067] scsi host3: uas_eh_bus_reset_handler start
      [10240.766164] usb 3-4: reset SuperSpeed USB device number 3 using xhci_hcd
      [10245.779365] usb 3-4: device descriptor read/8, error -110
      [10245.883331] usb 3-4: reset SuperSpeed USB device number 3 using xhci_hcd
      [10250.897603] usb 3-4: device descriptor read/8, error -110
      [10251.058200] BUG: unable to handle kernel NULL pointer dereference at  0000000000000040
      [10251.058244] IP: [<ffffffff815ac6e1>] xhci_check_streams_endpoint+0x91/0x140
      <snip>
      [10251.059473] Call Trace:
      [10251.059487]  [<ffffffff815aca6c>] xhci_calculate_streams_and_bitmask+0xbc/0x130
      [10251.059520]  [<ffffffff815aeb5f>] xhci_alloc_streams+0x10f/0x5a0
      [10251.059548]  [<ffffffff810a4685>] ? check_preempt_curr+0x75/0xa0
      [10251.059575]  [<ffffffff810a46dc>] ? ttwu_do_wakeup+0x2c/0x100
      [10251.059601]  [<ffffffff810a49e6>] ? ttwu_do_activate.constprop.111+0x66/0x70
      [10251.059635]  [<ffffffff815779ab>] usb_alloc_streams+0xab/0xf0
      [10251.059662]  [<ffffffffc0616b48>] uas_configure_endpoints+0x128/0x150 [uas]
      [10251.059694]  [<ffffffffc0616bac>] uas_post_reset+0x3c/0xb0 [uas]
      [10251.059722]  [<ffffffff815727d9>] usb_reset_device+0x1b9/0x2a0
      [10251.059749]  [<ffffffffc0616f42>] uas_eh_bus_reset_handler+0xb2/0x190 [uas]
      [10251.059781]  [<ffffffff81514293>] scsi_try_bus_reset+0x53/0x110
      [10251.059808]  [<ffffffff815163b7>] scsi_eh_bus_reset+0xf7/0x270
      <snip>
      
      The problem is the following call sequence (simplified):
      
      1) usb_reset_device
      2)  usb_reset_and_verify_device
      2)   hub_port_init
      3)    hub_port_finish_reset
      3)     xhci_discover_or_reset_device
              This frees xhci->devs[slot_id]->eps[ep_index].ring for all eps but 0
      4)    usb_get_device_descriptor
             This fails
      5)   hub_port_init fails
      6)  usb_reset_and_verify_device fails, does not restore device config
      7)  uas_post_reset
      8)   xhci_alloc_streams
            NULL deref on the free-ed ring
      
      This commit fixes this by not allowing usb_alloc_streams to continue if
      the device is not configured.
      
      Note that we do allow usb_free_streams to continue after a (logical)
      disconnect, as it is necessary to explicitly free the streams at the xhci
      controller level.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90a646c7
    • A
      usb: allow to supply the PHY in the drivers when using HCD · ef44cb42
      Antoine Tenart 提交于
      This patch modify the generic code handling PHYs to allow them to be
      supplied from the drivers. This adds checks to ensure no PHY was already
      there when looking for one in the generic code. This also makes sure we
      do not modify its state in the generic HCD functions, it was provided by
      the driver.
      Signed-off-by: NAntoine Tenart <antoine.tenart@free-electrons.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ef44cb42
  9. 29 9月, 2014 2 次提交
  10. 25 9月, 2014 1 次提交
    • M
      usb: Add LED triggers for USB activity · 0cfbd328
      Michal Sojka 提交于
      With this patch, USB activity can be signaled by blinking a LED. There
      are two triggers, one for activity on USB host and one for USB gadget.
      
      Both triggers should work with all host/device controllers. Tested only
      with musb.
      
      Performace: I measured performance overheads on ARM Cortex-A8 (TI
      AM335x) running on 600 MHz.
      
      Duration of usb_led_activity():
      - with no LED attached to the trigger:        2 ± 1 µs
      - with one GPIO LED attached to the trigger:  2 ± 1 µs or 8 ± 2 µs (two peaks in histogram)
      
      Duration of functions calling usb_led_activity() (with this patch
      applied and no LED attached to the trigger):
      - __usb_hcd_giveback_urb():    10 - 25 µs
      - usb_gadget_giveback_request(): 2 - 6 µs
      Signed-off-by: NMichal Sojka <sojka@merica.cz>
      Acked-by: NFelipe Balbi <balbi@ti.com>
      Tested-by: NFelipe Balbi <balbi@ti.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0cfbd328
  11. 24 9月, 2014 3 次提交
  12. 19 7月, 2014 1 次提交
  13. 28 5月, 2014 3 次提交
    • D
      usb: introduce port status lock · 5c79a1e3
      Dan Williams 提交于
      In general we do not want khubd to act on port status changes that are
      the result of in progress resets or USB runtime PM operations.
      Specifically port power control testing has been able to trigger an
      unintended disconnect in hub_port_connect_change(), paraphrasing:
      
      	if ((portstatus & USB_PORT_STAT_CONNECTION) && udev &&
      	    udev->state != USB_STATE_NOTATTACHED) {
      		if (portstatus & USB_PORT_STAT_ENABLE) {
      			/* Nothing to do */
      		} else if (udev->state == USB_STATE_SUSPENDED &&
      				udev->persist_enabled) {
      			...
      		} else {
      			/* Don't resuscitate */;
      		}
      	}
      
      ...by falling to the "Don't resuscitate" path or missing
      USB_PORT_STAT_CONNECTION because usb_port_resume() was in the middle of
      modifying the port status.
      
      So, we want a new lock to hold off khubd for a given port while the
      child device is being suspended, resumed, or reset.  The lock ordering
      rules are now usb_lock_device() => usb_lock_port().  This is mandated by
      the device core which may hold the device_lock on the usb_device before
      invoking usb_port_{suspend|resume} which in turn take the status_lock on
      the usb_port.  We attempt to hold the status_lock for the duration of a
      port_event() run, and drop/re-acquire it when needing to take the
      device_lock.  The lock is also dropped/re-acquired during
      hub_port_reconnect().
      
      This patch also deletes hub->busy_bits as all use cases are now covered
      by port PM runtime synchronization or the port->status_lock and it
      pushes down usb_device_lock() into usb_remote_wakeup().
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5c79a1e3
    • D
      usb: assign default peer ports for root hubs · d8521afe
      Dan Williams 提交于
      Assume that the peer of a superspeed port is the port with the same id
      on the shared_hcd root hub.  This identification scheme is required of
      external hubs by the USB3 spec [1].  However, for root hubs, tier mismatch
      may be in effect [2].  Tier mismatch can only be enumerated via platform
      firmware.  For now, simply perform the nominal association.
      
      A new lock 'usb_port_peer_mutex' is introduced to synchronize port
      device add/remove with peer lookups.  It protects peering against
      changes to hcd->shared_hcd, hcd->self.root_hub, hdev->maxchild, and
      port_dev->child pointers.
      
      [1]: usb 3.1 section 10.3.3
      [2]: xhci 1.1 appendix D
      
      Cc: Alan Stern <stern@rowland.harvard.edu>
      [alan: usb_port_peer_mutex locking scheme]
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8521afe
    • T
      USB: separate usb_address0 mutexes for each bus · 6fecd4f2
      Todd E Brandt 提交于
      This patch creates a separate instance of the usb_address0 mutex for each USB
      bus, and attaches it to the usb_bus device struct. This allows devices on
      separate buses to be enumerated in parallel; saving time.
      
      In the current code, there is a single, global instance of the usb_address0
      mutex which is used for all devices on all buses. This isn't completely
      necessary, as this mutex is only needed to prevent address0 collisions for
      devices on the *same* bus (usb 2.0 spec, sec 4.6.1). This superfluous coverage
      can cause additional delay in system resume on systems with multiple hosts
      (up to several seconds depending on what devices are attached).
      Signed-off-by: NTodd Brandt <todd.e.brandt@linux.intel.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6fecd4f2
  14. 20 5月, 2014 1 次提交
  15. 05 3月, 2014 2 次提交
  16. 23 1月, 2014 1 次提交
    • S
      Revert "usbcore: set lpm_capable field for LPM capable root hubs" · 140e3026
      Sarah Sharp 提交于
      Commit 9df89d85 "usbcore: set
      lpm_capable field for LPM capable root hubs" was created under the
      assumption that all USB host controllers should have USB 3.0 Link PM
      enabled for all devices under the hosts.
      
      Unfortunately, that's not the case.  The xHCI driver relies on knowledge
      of the host hardware scheduler to calculate the LPM U1/U2 timeout
      values, and it only sets lpm_capable to one for Intel host controllers
      (that have the XHCI_LPM_SUPPORT quirk set).
      
      When LPM is enabled for some Fresco Logic hosts, it causes failures with
      a AgeStar 3UBT USB 3.0 hard drive dock:
      
      Jan 11 13:59:03 sg-laptop kernel: usb 3-1: new SuperSpeed USB device number 2 using xhci_hcd
      Jan 11 13:59:03 sg-laptop kernel: usb 3-1: Set SEL for device-initiated U1 failed.
      Jan 11 13:59:08 sg-laptop kernel: usb 3-1: Set SEL for device-initiated U2 failed.
      Jan 11 13:59:08 sg-laptop kernel: usb-storage 3-1:1.0: USB Mass Storage device detected
      Jan 11 13:59:08 sg-laptop mtp-probe[613]: checking bus 3, device 2: "/sys/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/usb3/3-1"
      Jan 11 13:59:08 sg-laptop mtp-probe[613]: bus: 3, device: 2 was not an MTP device
      Jan 11 13:59:08 sg-laptop kernel: scsi6 : usb-storage 3-1:1.0
      Jan 11 13:59:13 sg-laptop kernel: usb 3-1: Set SEL for device-initiated U1 failed.
      Jan 11 13:59:18 sg-laptop kernel: usb 3-1: Set SEL for device-initiated U2 failed.
      Jan 11 13:59:18 sg-laptop kernel: usbcore: registered new interface driver usb-storage
      Jan 11 13:59:40 sg-laptop kernel: usb 3-1: reset SuperSpeed USB device number 2 using xhci_hcd
      Jan 11 13:59:41 sg-laptop kernel: usb 3-1: device descriptor read/8, error -71
      Jan 11 13:59:41 sg-laptop kernel: usb 3-1: reset SuperSpeed USB device number 2 using xhci_hcd
      Jan 11 13:59:46 sg-laptop kernel: usb 3-1: device descriptor read/8, error -110
      Jan 11 13:59:46 sg-laptop kernel: scsi 6:0:0:0: Device offlined - not ready after error recovery
      Jan 11 13:59:46 sg-laptop kernel: usb 3-1: USB disconnect, device number 2
      
      lspci for the affected host:
      
      04:00.0 0c03: 1b73:1000 (rev 04) (prog-if 30 [XHCI])
              Subsystem: 1043:1039
              Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
              Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
              Latency: 0, Cache Line Size: 64 bytes
              Interrupt: pin A routed to IRQ 19
              Region 0: Memory at dd200000 (32-bit, non-prefetchable) [size=64K]
              Capabilities: [50] Power Management version 3
                      Flags: PMEClk- DSI- D1- D2- AuxCurrent=0mA PME(D0+,D1-,D2-,D3hot+,D3cold-)
                      Status: D0 NoSoftRst- PME-Enable- DSel=0 DScale=0 PME-
              Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
                      Address: 0000000000000000  Data: 0000
              Capabilities: [80] Express (v1) Endpoint, MSI 00
                      DevCap: MaxPayload 128 bytes, PhantFunc 0, Latency L0s <2us, L1 <32us
                              ExtTag- AttnBtn- AttnInd- PwrInd- RBE+ FLReset-
                      DevCtl: Report errors: Correctable- Non-Fatal- Fatal- Unsupported-
                              RlxdOrd+ ExtTag- PhantFunc- AuxPwr- NoSnoop+
                              MaxPayload 128 bytes, MaxReadReq 512 bytes
                      DevSta: CorrErr- UncorrErr- FatalErr- UnsuppReq- AuxPwr- TransPend-
                      LnkCap: Port #0, Speed 2.5GT/s, Width x1, ASPM L0s L1, Latency L0 unlimited, L1 unlimited
                              ClockPM- Surprise- LLActRep- BwNot-
                      LnkCtl: ASPM Disabled; RCB 64 bytes Disabled- Retrain- CommClk+
                              ExtSynch- ClockPM- AutWidDis- BWInt- AutBWInt-
                      LnkSta: Speed 2.5GT/s, Width x1, TrErr- Train- SlotClk+ DLActive- BWMgmt- ABWMgmt-
              Kernel driver in use: xhci_hcd
              Kernel modules: xhci_hcd
      
      The commit was backported to stable kernels, and will need to be
      reverted there as well.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@intel.com>
      Reported-by: NSergey Galanov <sergey.e.galanov@gmail.com>
      Cc: stable@vger.kernel.org
      140e3026
  17. 08 1月, 2014 1 次提交
  18. 09 12月, 2013 3 次提交
  19. 15 10月, 2013 1 次提交
  20. 12 10月, 2013 2 次提交
    • M
      drivers: usb: core: hcd.c: converted busmap from struct to bitmap · 059239ad
      Matthias Beyer 提交于
      The DECLARE_BITMAP macro should be used for declaring this bitmap.
      This commit converts the busmap from a struct to a simple (static)
      bitmap, using the DECLARE_BITMAP macro from linux/types.h.
      
      Please review, as I'm new to kernel development, I don't know if this
      has any hidden side effects!
      
      Suggested by joe@perches.com
      Signed-off-by: NMatthias Beyer <mail@beyermatthias.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      059239ad
    • H
      usb-anchor: Delay usb_wait_anchor_empty_timeout wake up till completion is done · 6ec4147e
      Hans de Goede 提交于
      usb_wait_anchor_empty_timeout() should wait till the completion handler
      has run. Both the zd1211rw driver and the uas driver (in its task mgmt) depend
      on the completion handler having completed when usb_wait_anchor_empty_timeout()
      returns, as they read state set by the completion handler after an
      usb_wait_anchor_empty_timeout() call.
      
      But __usb_hcd_giveback_urb() calls usb_unanchor_urb before calling the
      completion handler. This is necessary as the completion handler may
      re-submit and re-anchor the urb. But this introduces a race where the state
      these drivers want to read has not been set yet by the completion handler
      (this race is easily triggered with the uas task mgmt code).
      
      I've considered adding an anchor_count to struct urb, which would be
      incremented on anchor and decremented on unanchor, and then only actually
      do the anchor / unanchor on 0 -> 1 and 1 -> 0 transtions, combined with
      moving the unanchor call in hcd_giveback_urb to after calling the completion
      handler. But this will only work if urb's are only re-anchored to the same
      anchor as they were anchored to before the completion handler ran.
      
      And at least one driver re-anchors to another anchor from the completion
      handler (rtlwifi).
      
      So I have come up with this patch instead, which adds the ability to
      suspend wakeups of usb_wait_anchor_empty_timeout() waiters to the usb_anchor
      functionality, and uses this in __usb_hcd_giveback_urb() to delay wake-ups
      until the completion handler has run.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NOliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ec4147e
  21. 06 10月, 2013 5 次提交
  22. 18 9月, 2013 2 次提交