1. 23 9月, 2015 1 次提交
  2. 19 8月, 2015 1 次提交
  3. 15 8月, 2015 1 次提交
  4. 23 7月, 2015 1 次提交
  5. 04 12月, 2014 1 次提交
  6. 08 1月, 2014 1 次提交
  7. 17 10月, 2013 1 次提交
    • S
      usb: Don't enable USB 2.0 Link PM by default. · de68bab4
      Sarah Sharp 提交于
      How it's supposed to work:
      --------------------------
      
      USB 2.0 Link PM is a lower power state that some newer USB 2.0 devices
      support.  USB 3.0 devices certified by the USB-IF are required to
      support it if they are plugged into a USB 2.0 only port, or a USB 2.0
      cable is used.  USB 2.0 Link PM requires both a USB device and a host
      controller that supports USB 2.0 hardware-enabled LPM.
      
      USB 2.0 Link PM is designed to be enabled once by software, and the host
      hardware handles transitions to the L1 state automatically.  The premise
      of USB 2.0 Link PM is to be able to put the device into a lower power
      link state when the bus is idle or the device NAKs USB IN transfers for
      a specified amount of time.
      
      ...but hardware is broken:
      --------------------------
      
      It turns out many USB 3.0 devices claim to support USB 2.0 Link PM (by
      setting the LPM bit in their USB 2.0 BOS descriptor), but they don't
      actually implement it correctly.  This manifests as the USB device
      refusing to respond to transfers when it is plugged into a USB 2.0 only
      port under the Haswell-ULT/Lynx Point LP xHCI host.
      
      These devices pass the xHCI driver's simple test to enable USB 2.0 Link
      PM, wait for the port to enter L1, and then bring it back into L0.  They
      only start to break when L1 entry is interleaved with transfers.
      
      Some devices then fail to respond to the next control transfer (usually
      a Set Configuration).  This results in devices never enumerating.
      
      Other mass storage devices (such as a later model Western Digital My
      Passport USB 3.0 hard drive) respond fine to going into L1 between
      control transfers.  They ACK the entry, come out of L1 when the host
      needs to send a control transfer, and respond properly to those control
      transfers.  However, when the first READ10 SCSI command is sent, the
      device NAKs the data phase while it's reading from the spinning disk.
      Eventually, the host requests to put the link into L1, and the device
      ACKs that request.  Then it never responds to the data phase of the
      READ10 command.  This results in not being able to read from the drive.
      
      Some mass storage devices (like the Corsair Survivor USB 3.0 flash
      drive) are well behaved.  They ACK the entry into L1 during control
      transfers, and when SCSI commands start coming in, they NAK the requests
      to go into L1, because they need to be at full power.
      
      Not all USB 3.0 devices advertise USB 2.0 link PM support.  My Point
      Grey USB 3.0 webcam advertises itself as a USB 2.1 device, but doesn't
      have a USB 2.0 BOS descriptor, so we don't enable USB 2.0 Link PM.  I
      suspect that means the device isn't certified.
      
      What do we do about it?
      -----------------------
      
      There's really no good way for the kernel to test these devices.
      Therefore, the kernel needs to disable USB 2.0 Link PM by default, and
      distros will have to enable it by writing 1 to the sysfs file
      /sys/bus/usb/devices/../power/usb2_hardware_lpm.  Rip out the xHCI Link
      PM test, since it's not sufficient to detect these buggy devices, and
      don't automatically enable LPM after the device is addressed.
      
      This patch should be backported to kernels as old as 3.11, that
      contain the commit a558ccdc "usb: xhci:
      add USB2 Link power management BESL support".  Without this fix, some
      USB 3.0 devices will not enumerate or work properly under USB 2.0 ports
      on Haswell-ULT systems.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable@vger.kernel.org
      de68bab4
  8. 12 10月, 2013 1 次提交
  9. 26 9月, 2013 1 次提交
    • A
      USB: fix substandard locking for the sysfs files · 232275a0
      Alan Stern 提交于
      This patch straightens out some locking issues in the USB sysfs
      interface:
      
      	Deauthorization will destroy existing configurations.
      	Attributes that read from udev->actconfig need to lock the
      	device to prevent races.  Likewise for the rawdescriptor
      	values.
      
      	Attributes that access an interface's current alternate
      	setting should use ACCESS_ONCE() to obtain the cur_altsetting
      	pointer, to protect against concurrent altsetting changes.
      
      	The supports_autosuspend() attribute routine accesses values
      	from an interface's driver, so it should lock the interface
      	(rather than the usb_device) to protect against concurrent
      	unbinds.  Once this is done, the routine can be simplified
      	considerably.
      
      Scalar values that are stored directly in the usb_device structure are
      always available.  They do not require any locking.  The same is true
      of the cached interface string descriptor, because it is not
      deallocated until the usb_host_interface structure is destroyed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Hans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      232275a0
  10. 26 8月, 2013 1 次提交
  11. 06 6月, 2013 1 次提交
  12. 29 3月, 2013 1 次提交
    • A
      USB: remove CONFIG_USB_SUSPEND option · 84ebc102
      Alan Stern 提交于
      This patch (as1675) removes the CONFIG_USB_SUSPEND option, essentially
      replacing it everywhere with CONFIG_PM_RUNTIME (except for one place
      in hub.c, where it is replaced with CONFIG_PM because the code needs
      to be used in both runtime and system PM).  The net result is code
      shrinkage and simplification.
      
      There's very little point in keeping CONFIG_USB_SUSPEND because almost
      everybody enables it.  The few that don't will find that the usbcore
      module has gotten somewhat bigger and they will have to take active
      measures if they want to prevent hubs from being runtime suspended.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Peter Chen <peter.chen@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      84ebc102
  13. 12 1月, 2013 1 次提交
  14. 21 8月, 2012 1 次提交
  15. 11 8月, 2012 1 次提交
  16. 11 7月, 2012 1 次提交
  17. 14 6月, 2012 1 次提交
    • B
      USB: allow match on bInterfaceNumber · 81df2d59
      Bjørn Mork 提交于
      Some composite USB devices provide multiple interfaces
      with different functions, all using "vendor-specific"
      for class/subclass/protocol.  Another OS use interface
      numbers to match the driver and interface. It seems
      these devices are designed with that in mind - using
      static interface numbers for the different functions.
      
      This adds support for matching against the
      bInterfaceNumber, allowing such devices to be supported
      without having to resort to testing against interface
      number whitelists and/or blacklists in the probe.
      Signed-off-by: NBjørn Mork <bjorn@mork.no>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      81df2d59
  18. 15 5月, 2012 1 次提交
    • A
      sysfs: get rid of some lockdep false positives · 356c05d5
      Alan Stern 提交于
      This patch (as1554) fixes a lockdep false-positive report.  The
      problem arises because lockdep is unable to deal with the
      tree-structured locks created by the device core and sysfs.
      
      This particular problem involves a sysfs attribute method that
      unregisters itself, not from the device it was called for, but from a
      descendant device.  Lockdep doesn't understand the distinction and
      reports a possible deadlock, even though the operation is safe.
      
      This is the sort of thing that would normally be handled by using a
      nested lock annotation; unfortunately it's not feasible to do that
      here.  There's no sensible way to tell sysfs when attribute removal
      occurs in the context of a parent attribute method.
      
      As a workaround, the patch adds a new flag to struct attribute
      telling sysfs not to inform lockdep when it acquires a readlock on a
      sysfs_dirent instance for the attribute.  The readlock is still
      acquired, but lockdep doesn't know about it and hence does not
      complain about impossible deadlock scenarios.
      
      Also added are macros for static initialization of attribute
      structures with the ignore_lockdep flag set.  The three offending
      attributes in the USB subsystem are converted to use the new macros.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NTejun Heo <tj@kernel.org>
      CC: Eric W. Biederman <ebiederm@xmission.com>
      CC: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      356c05d5
  19. 10 2月, 2012 1 次提交
  20. 04 1月, 2012 1 次提交
  21. 27 9月, 2011 1 次提交
  22. 30 4月, 2011 1 次提交
  23. 17 11月, 2010 2 次提交
  24. 22 5月, 2010 1 次提交
  25. 21 5月, 2010 2 次提交
  26. 03 3月, 2010 6 次提交
    • A
      USB: change handling of negative autosuspend delays · 5899f1e0
      Alan Stern 提交于
      This patch (as1327) changes the way negative autosuspend delays
      prevent device from autosuspending.  The current code checks for
      negative values explicitly in the autosuspend_check() routine.  The
      updated code keeps things from getting that far by using
      usb_autoresume_device() to increment the usage counter when a negative
      delay is set, and by using usb_autosuspend_device() to decrement the
      usage counter when a non-negative delay is set.
      
      This complicates the set_autosuspend() attribute method code slightly,
      but it will reduce the overall power management overhead.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5899f1e0
    • A
      USB: implement usb_enable_autosuspend · 088f7fec
      Alan Stern 提交于
      This patch (as1326) adds usb_enable_autosuspend() and
      usb_disable_autosuspend() routines for use by drivers.  If a driver
      knows that its device can handle suspends and resumes correctly, it
      can enable autosuspend all by itself.  This is equivalent to the user
      writing "auto" to the device's power/level attribute.
      
      The implementation differs slightly from what it used to be.  Now
      autosuspend is disabled simply by doing usb_autoresume_device() (to
      increment the usage counter) and enabled by doing
      usb_autosuspend_device() (to decrement the usage counter).
      
      The set_level() attribute method is updated to use the new routines,
      and the USB Power-Management documentation is updated.
      
      The patch adds a usb_enable_autosuspend() call to the hub driver's
      probe routine, allowing the special-case code for hubs in quirks.c to
      be removed.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      088f7fec
    • A
      USB: use the device lock for persist_enabled · 0c4db6df
      Alan Stern 提交于
      This patch (as1325) changes the locking for the persist_enabled flag
      in struct usb_device.  Now it is protected by the device lock, along
      with all its neighboring bit flags, instead of the PM lock (which is
      about to vanish anyway).
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0c4db6df
    • A
      USB: change locking for device-level autosuspend · 62e299e6
      Alan Stern 提交于
      This patch (as1323) changes the locking requirements for
      usb_autosuspend_device(), usb_autoresume_device(), and
      usb_try_autosuspend_device().  This isn't a very important change;
      mainly it's meant to make the locking more uniform.
      
      The most tricky part of the patch involves changes to usbdev_open().
      To avoid an ABBA locking problem, it was necessary to reduce the
      region protected by usbfs_mutex.  Since that mutex now protects only
      against simultaneous open and remove, this posed no difficulty -- its
      scope was larger than necessary.
      
      And it turns out that usbfs_mutex is no longer needed in
      usbdev_release() at all.  The list of usbfs "ps" structures is now
      protected by the device lock instead of by usbfs_mutex.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      62e299e6
    • G
      USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS · 551cdbbe
      Greg Kroah-Hartman 提交于
      It's really the wireless speed, so rename the thing to make
      more sense.  Based on a recommendation from David Vrabel
      
      Cc: David Vrabel <david.vrabel@csr.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      551cdbbe
    • O
      USB: Export QUIRK_RESET_MORPHS through sysfs · ef955341
      Oliver Neukum 提交于
      Some devices which use mode switching revert to their
      primary mode as they are reset. They must not be reset for
      error handling. As user spaces makes the switch it also
      has to tell the kernel that a device is quirky.
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ef955341
  27. 21 1月, 2010 1 次提交
  28. 24 12月, 2009 1 次提交
    • A
      USB: fix bugs in usb_(de)authorize_device · da307123
      Alan Stern 提交于
      This patch (as1315) fixes some bugs in the USB core authorization
      code:
      
      	usb_deauthorize_device() should deallocate the device strings
      	instead of leaking them, and it should invoke
      	usb_destroy_configuration() (which does proper reference
      	counting) instead of freeing the config information directly.
      
      	usb_authorize_device() shouldn't change the device strings
      	until it knows that the authorization will succeed, and it should
      	autosuspend the device at the end (having autoresumed the
      	device at the start).
      
      	Because the device strings can be changed, the sysfs routines
      	to display the strings must protect the string pointers by
      	locking the device.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: Inaky Perez-Gonzalez <inaky@linux.intel.com>
      Acked-by: NDavid Vrabel <david.vrabel@csr.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      da307123
  29. 12 12月, 2009 3 次提交
    • A
      USB: prepare for changover to Runtime PM framework · 8e4ceb38
      Alan Stern 提交于
      This patch (as1303) revises the USB Power Management infrastructure to
      make it compatible with the new driver-model Runtime PM framework:
      
      	Drivers are no longer allowed to access intf->pm_usage_cnt
      	directly; the PM framework manages its own usage counters.
      
      	usb_autopm_set_interface() is eliminated, because it directly
      	sets intf->pm_usage_cnt.
      
      	usb_autopm_enable() and usb_autopm_disable() are eliminated,
      	because they call usb_autopm_set_interface().
      
      	usb_autopm_get_interface_no_resume() and
      	usb_autopm_put_interface_no_suspend() are added.  They
      	correspond to pm_runtime_get_noresume() and
      	pm_runtime_put_noidle() in the PM framework.
      
      	The power/level attribute no longer accepts "suspend", only
      	"on" and "auto".  The PM framework doesn't allow devices to be
      	forced into a suspended mode.
      
      The hub driver contains the only code that violates the new
      guidelines.  It is updated to use the new interface routines instead.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      8e4ceb38
    • G
      USB: add devpath sysfs attribute · 9af23624
      Greg Kroah-Hartman 提交于
      This is not exported from the usb core, yet we rely on it to create
      paths to interfaces for this device in sysfs.  Export it to make
      userspace tools have an easier time to figure things out.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9af23624
    • A
      USB: add a "remove hardware" sysfs attribute · 253e0572
      Alan Stern 提交于
      This patch (as1297) adds a "remove" attribute to each USB device's
      directory in sysfs.  Writing to this attribute causes the device to be
      deconfigured (the same as writing 0 to the "bConfigurationValue"
      attribute) and then tells the hub driver to disable the device's
      upstream port.  The device remains locked during these activities so
      there is no possibility of it getting reconfigured in between.  The
      port will remain disabled until after the device is unplugged.
      
      The purpose of this is to provide a means for user programs to imitate
      the "Safely remove hardware" applet in Windows.  Some devices do
      expect their ports to be disabled before they are unplugged, and they
      provide visual feedback to users indicating when they can safely be
      unplugged.
      
      The security implications are minimal.  Writing to the "remove"
      attribute is no more dangerous than writing to the
      "bConfigurationValue" attribute.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: David Zeuthen <davidz@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      253e0572
  30. 16 9月, 2009 1 次提交
  31. 16 6月, 2009 1 次提交