1. 28 5月, 2014 10 次提交
  2. 20 5月, 2014 1 次提交
  3. 17 4月, 2014 1 次提交
    • A
      USB: fix crash during hotplug of PCI USB controller card · a2ff864b
      Alan Stern 提交于
      The code in hcd-pci.c that matches up EHCI controllers with their
      companion UHCI or OHCI controllers assumes that the private drvdata
      fields don't get set too early.  However, it turns out that this field
      gets set by usb_create_hcd(), before hcd-pci expects it, and this can
      result in a crash when two controllers are probed in parallel (as can
      happen when a new controller card is hotplugged).
      
      The companions_rwsem lock was supposed to prevent this sort of thing,
      but usb_create_hcd() is called outside the scope of the rwsem.
      
      A simple solution is to check that the root-hub pointer has been
      initialized as well as the drvdata field.  This doesn't happen until
      usb_add_hcd() is called; that call and the check are both protected by
      the rwsem.
      
      This patch should be applied to stable kernels from 3.10 onward.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NStefani Seibold <stefani@seibold.net>
      Tested-by: NStefani Seibold <stefani@seibold.net>
      CC: <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a2ff864b
  4. 20 3月, 2014 1 次提交
    • A
      USB: disable reset-resume when USB_QUIRK_RESET is set · 1d10255c
      Alan Stern 提交于
      The USB_QUIRK_RESET flag indicates that a USB device changes its
      identity in some way when it is reset.  It may lose its firmware, its
      descriptors may change, or it may switch back to a default mode of
      operation.
      
      If a device does this, the kernel needs to avoid resetting it.  Resets
      are likely to fail, or worse, succeed while changing the device's
      state in a way the system can't detect.
      
      This means we should disable the reset-resume mechanism whenever this
      quirk flag is present.  An attempted reset-resume will fail, the
      device will be logically disconnected, and later on the hub driver
      will rediscover and re-enumerate the device.  This will cause the
      appropriate udev events to be generated, so that userspace will have a
      chance to switch the device into its normal operating mode, if
      necessary.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Oliver Neukum <oliver@neukum.org>
      Reviewed-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1d10255c
  5. 18 3月, 2014 1 次提交
    • A
      USB: unbind all interfaces before rebinding any · 6aec044c
      Alan Stern 提交于
      When a driver doesn't have pre_reset, post_reset, or reset_resume
      methods, the USB core unbinds that driver when its device undergoes a
      reset or a reset-resume, and then rebinds it afterward.
      
      The existing straightforward implementation can lead to problems,
      because each interface gets unbound and rebound before the next
      interface is handled.  If a driver claims additional interfaces, the
      claim may fail because the old binding instance may still own the
      additional interface when the new instance tries to claim it.
      
      This patch fixes the problem by first unbinding all the interfaces
      that are marked (i.e., their needs_binding flag is set) and then
      rebinding all of them.
      
      The patch also makes the helper functions in driver.c a little more
      uniform and adjusts some out-of-date comments.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-and-tested-by: N"Poulain, Loic" <loic.poulain@intel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6aec044c
  6. 11 3月, 2014 1 次提交
  7. 09 3月, 2014 1 次提交
  8. 08 3月, 2014 2 次提交
    • J
      usb: Make DELAY_INIT quirk wait 100ms between Get Configuration requests · d86db25e
      Julius Werner 提交于
      The DELAY_INIT quirk only reduces the frequency of enumeration failures
      with the Logitech HD Pro C920 and C930e webcams, but does not quite
      eliminate them. We have found that adding a delay of 100ms between the
      first and second Get Configuration request makes the device enumerate
      perfectly reliable even after several weeks of extensive testing. The
      reasons for that are anyone's guess, but since the DELAY_INIT quirk
      already delays enumeration by a whole second, wating for another 10th of
      that isn't really a big deal for the one other device that uses it, and
      it will resolve the problems with these webcams.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d86db25e
    • J
      usb: Add device quirk for Logitech HD Pro Webcams C920 and C930e · e0429362
      Julius Werner 提交于
      We've encountered a rare issue when enumerating two Logitech webcams
      after a reboot that doesn't power cycle the USB ports. They are spewing
      random data (possibly some leftover UVC buffers) on the second
      (full-sized) Get Configuration request of the enumeration phase. Since
      the data is random this can potentially cause all kinds of odd behavior,
      and since it occasionally happens multiple times (after the kernel
      issues another reset due to the garbled configuration descriptor), it is
      not always recoverable. Set the USB_DELAY_INIT quirk that seems to work
      around the issue.
      Signed-off-by: NJulius Werner <jwerner@chromium.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e0429362
  9. 07 3月, 2014 1 次提交
    • T
      usb: don't use PREPARE_DELAYED_WORK · 77fa83cf
      Tejun Heo 提交于
      PREPARE_[DELAYED_]WORK() are being phased out.  They have few users
      and a nasty surprise in terms of reentrancy guarantee as workqueue
      considers work items to be different if they don't have the same work
      function.
      
      usb_hub->init_work is multiplexed with multiple work functions;
      however, the work item is never queued while in-flight, so we can
      simply use INIT_DELAYED_WORK() before each queueing.
      
      It would probably be best to route this with other related updates
      through the workqueue tree.
      
      Lightly tested.
      
      v2: Greg and Alan confirm that the work item is never queued while
          in-flight.  Simply use INIT_DELAYED_WORK().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: linux-usb@vger.kernel.org
      77fa83cf
  10. 05 3月, 2014 12 次提交
    • H
      usb: Reset USB-3 devices on USB-3 link bounce · a82b76f7
      Hans de Goede 提交于
      On disconnect USB3 protocol ports transit from U0 to SS.Inactive to Rx.Detect,
      on a recoverable error, the port stays in SS.Inactive and we recover from it by
      doing a warm-reset (through usb_device_reset if we have a udev for the port).
      
      If this really is a disconnect we may end up trying the warm-reset anyways,
      since khubd may run before the SS.Inactive to Rx.Detect transition, or it
      may get skipped if the transition to Rx.Detect happens before khubd gets run.
      
      With a loose connector, or in the case which actually led me to debugging this
      bad ACPI firmware toggling Vbus off and on in quick succession, the port
      may transition from Rx.Detect to U0 again before khubd gets run. In this case
      the device state is unknown really, but khubd happily goes into the resuscitate
      an existing device path, and the device driver never gets notified about the
      device state being messed up.
      
      If the above scenario happens with a streams using device, as soon as an urb
      is submitted to an endpoint with streams, the following appears in dmesg:
      
      ERROR Transfer event for disabled endpoint or incorrect stream ring
      @0000000036807420 00000000 00000000 04000000 04078000
      
      Notice how the TRB address is all zeros. I've seen this both on Intel
      Pantherpoint and Nec xhci hosts.
      
      Luckily we can detect the U0 to SS.Inactive to Rx.Detect to U0 all having
      happened before khubd runs case since the C_LINK_STATE bit gets set in the
      portchange bits on the U0 -> SS.Inactive change. This bit will also be set on
      suspend / resume, but then it gets cleared by port_hub_init before khubd runs.
      
      So if the C_LINK_STATE bit is set and a warm-reset is not needed, iow the port
      is not still in SS.Inactive, and the port still has a connection, then the
      device needs to be reset to put it back in a known state.
      
      I've verified that doing the device reset also fixes the transfer event with
      all zeros address issue.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      a82b76f7
    • H
      usb: Clear host_endpoint->streams when implicitly freeing streams · 7a7b562d
      Hans de Goede 提交于
      If streams are still allocated on device-reset or set-interface then the hcd
      code implictly frees the streams. Clear host_endpoint->streams in this case
      so that if a driver later tries to re-allocate them it won't run afoul of the
      device already having streams check in usb_alloc_streams().
      
      Note normally streams still being allocated at reset / set-intf  would be a
      driver bug, but this can happen without it being a driver bug on reset-resume.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      7a7b562d
    • H
      usbfs: Add support for allocating / freeing streams · bcf7f6e3
      Hans de Goede 提交于
      This allows userspace to use bulk-streams, just like in kernel drivers, see
      Documentation/usb/bulk-streams.txt for details on the in kernel API. This
      is exported pretty much one on one to userspace.
      
      To use streams an app must first make a USBDEVFS_ALLOC_STREAMS ioctl,
      on success this will return the number of streams available (which may be
      less then requested). If there are n streams the app can then submit
      usbdevfs_urb-s with their stream_id member set to 1-n to use a specific
      stream. IE if USBDEVFS_ALLOC_STREAMS returns 4 then stream_id 1-4 can be
      used.
      
      When the app is done using streams it should call USBDEVFS_FREE_STREAMS
      
      Note applications are advised to use libusb rather then using the
      usbdevfs api directly. The latest version of libusb has support for streams.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      bcf7f6e3
    • H
      2fec32b0
    • H
      usbfs: Add support for bulk stream ids · 948cd8c1
      Hans de Goede 提交于
      This patch makes it possible to specify a bulk stream id when submitting
      an urb using the async usbfs API. It overloads the number_of_packets
      usbdevfs_urb field for this. This is not pretty, but given other
      constraints it is the best we can do. The reasoning leading to this goes
      as follows:
      
      1) We want to support bulk streams in the usbfs API
      2) We do not want to extend the usbdevfs_urb struct with a new member, as
         that would mean defining new ioctl numbers for all async API ioctls +
         adding compat versions for the old ones (times 2 for 32 bit support)
      3) 1 + 2 means we need to re-use an existing field
      4) number_of_packets is only used for isoc urbs, and streams are bulk only
         so it is the best (and only) candidate for re-using
      
      Note that:
      1) This patch only uses number_of_packets as stream_id if the app has
         actually allocated streams on the ep, so that old apps which may have
         garbage in there (as it was unused until now in the bulk case), will not
         break
      2) This patch does not add support for allocating / freeing bulk-streams, that
         is done in a follow up patch
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      948cd8c1
    • H
      usbfs: proc_do_submiturb use a local variable for number_of_packets · b2d03eb5
      Hans de Goede 提交于
      This is a preparation patch for adding support for bulk streams.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      b2d03eb5
    • H
      usbfs: Kill urbs on interface before doing a set_interface · 5ec9c177
      Hans de Goede 提交于
      The usb_set_interface documentation says:
      
       * Also, drivers must not change altsettings while urbs are scheduled for
       * endpoints in that interface; all such urbs must first be completed
       * (perhaps forced by unlinking).
      
      For in kernel drivers we trust the drivers to get this right, but we
      cannot trust userspace to get this right, so enforce it by killing any
      urbs still pending on the interface.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      5ec9c177
    • H
      usb-core: Free bulk streams on interface release · 6343e8bf
      Hans de Goede 提交于
      Documentation/usb/bulk-streams.txt says:
      
      All stream IDs will be deallocated when the driver releases the interface, to
      ensure that drivers that don't support streams will be able to use the endpoint
      
      This commit actually implements this.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      6343e8bf
    • H
      usb-core: Track if an endpoint has streams · 8d4f70b2
      Hans de Goede 提交于
      This is a preparation patch for adding support for bulk streams to usbfs.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      8d4f70b2
    • H
      usb-core: Move USB_MAXENDPOINTS definitions to usb.h · 8f5d3544
      Hans de Goede 提交于
      So that it can be used in other places too.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      8f5d3544
    • H
    • S
      usb/xhci: Change how we indicate a host supports Link PM. · 25cd2882
      Sarah Sharp 提交于
      The xHCI driver currently uses a USB core internal field,
      udev->lpm_capable, to indicate the xHCI driver knows how to calculate
      the LPM timeout values.  If this value is set for the host controller
      udev, it means Link PM can be enabled for child devices under that host.
      
      Change the code so the xHCI driver isn't mucking with USB core internal
      fields.  Instead, indicate the xHCI driver doesn't support Link PM on
      this host by clearing the U1 and U2 exit latencies in the roothub
      SuperSpeed Extended Capabilities BOS descriptor.
      
      The code to check for the roothub setting U1 and U2 exit latencies to
      zero will also disable LPM for external devices that do that same.  This
      was already effectively done with commit
      ae8963ad "usb: Don't enable LPM if the
      exit latency is zero."  Leave that code in place, so that if a device
      sets one exit latency value to zero, but the other is set to a valid
      value, LPM is only enabled for the U1 or U2 state that had the valid
      value.  This is the same behavior the code had before.
      
      Also, change messages about missing Link PM information from warning
      level to info level.  Only print a warning about the first device that
      doesn't support LPM, to avoid log spam.  Further, cleanup some
      unnecessary line breaks to help people to grep for the error messages.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      25cd2882
  11. 01 3月, 2014 2 次提交
  12. 25 2月, 2014 1 次提交
    • A
      USB: complain if userspace resets an active endpoint · f080a51b
      Alan Stern 提交于
      It is an error for a driver to call usb_clear_halt() or
      usb_reset_endpoint() while there are URBs queued for the endpoint,
      because the end result is not well defined.  At the time the endpoint
      gets reset, it may or may not be actively running.
      
      As far as I know, no kernel drivers do this.  But some userspace
      drivers do, and it seems like a good idea to bring this error to their
      attention.
      
      This patch adds a warning to the kernel log whenever a program invokes
      the USBDEVFS_CLEAR_HALT or USBDEVFS_RESETEP ioctls at an inappropriate
      time, and includes the name of the program.  This will make it clear
      that any subsequent errors are not due to the misbehavior of a kernel
      driver.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Suggested-by: NBjørn Mork <bjorn@mork.no>
      CC: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f080a51b
  13. 20 2月, 2014 1 次提交
  14. 19 2月, 2014 1 次提交
  15. 08 2月, 2014 3 次提交
    • S
      usb: move hub init and LED blink work to power efficient workqueue · 22f6a0f0
      Shaibal Dutta 提交于
      Allow the scheduler to select the best CPU to handle hub initalization
      and LED blinking work. This extends idle residency times on idle CPUs
      and conserves power.
      
      This functionality is enabled when CONFIG_WQ_POWER_EFFICIENT is selected.
      
      [zoran.markovic@linaro.org: Rebased to latest kernel. Added commit message.
      Changed reference from system to power efficient workqueue for LEDs in
      check_highspeed() and hub_port_connect_change().]
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: Xenia Ragiadakou <burzalodowa@gmail.com>
      Cc: Julius Werner <jwerner@chromium.org>
      Cc: Krzysztof Mazur <krzysiek@podlesie.net>
      Cc: Matthias Beyer <mail@beyermatthias.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
      Cc: Thomas Pugliese <thomas.pugliese@gmail.com>
      Signed-off-by: NShaibal Dutta <shaibal.dutta@broadcom.com>
      Signed-off-by: NZoran Markovic <zoran.markovic@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      22f6a0f0
    • B
      usb: core: let dynamic ids override static ids · 31c6bf70
      Bjørn Mork 提交于
      This modifies the probing order so that any matching
      dynamic entry always will be used, even if the driver
      has a matching static entry.
      
      It is sometimes useful to dynamically update existing
      device entries. With the new ability to set the dynamic
      entry driver_info field, this can be used to test new
      additions to class driver exception lists or proposed
      changes to existing static per-device driver_info
      entries.
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      31c6bf70
    • V
      staging: usbip: convert usbip-host driver to usb_device_driver · b7945b77
      Valentina Manea 提交于
      This driver was previously an interface driver. Since USB/IP
      exports a whole device, not just an interface, it would make
      sense to be a device driver.
      
      This patch also modifies the way userspace sees and uses a
      shared device:
      
      * the usbip_status file is no longer created for interface 0, but for
      the whole device (such as
      /sys/devices/pci0000:00/0000:00:01.2/usb1/1-1/usbip_status).
      * per interface information, such as interface class or protocol, is
      no longer sent/received; only device specific information is
      transmitted.
      * since the driver was moved one level below in the USB architecture,
      there is no need to bind/unbind each interface, just the device as a
      whole.
      Signed-off-by: NValentina Manea <valentina.manea.m@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7945b77
  16. 06 2月, 2014 1 次提交