linux-stable/drivers/usb/core
Sarah Sharp 6d1d051330 USB: Fix LPM disable/enable during device reset.
The USB 3.0 specification says that sending a Set Feature or Clear
Feature for U1/U2 Enable is not a valid request when the device is in
the Default or Addressed state.  It is only valid when the device is in
the Configured state.

The original LPM patch attempted to disable LPM after the device had
been reset by hub_port_init(), before it had the configuration
reinstalled.  The TI hub I tested with did not fail the Clear Feature
U1/U2 Enable request that khubd sent while it was in the addressed
state, which is why I didn't catch it.

Move the LPM disable before the device reset, so that we can send the
Clear Feature U1/U2 Enable successfully, and balance the LPM disable
count.

Also delete any calls to usb_enable_lpm() on error paths that lead to
re-enumeration.  The calls will fail because the device isn't
configured, and it's not useful to balance the LPM disable count because
the usb_device is about to be destroyed before re-enumeration.

Fix the early exit path ("done" label) to call usb_enable_lpm() to
balance the LPM disable count.

Note that calling usb_reset_and_verify_device() with an unconfigured
device may fail on the first call to usb_disable_lpm().  That's because
the LPM disable count is initialized to 0 (LPM enabled), and
usb_disable_lpm() will attempt to send a Clear Feature U1/U2 request to
a device in the Addressed state.  The next patch will fix that.

This commit should be backported to kernels as old as 3.5, that contain
the commit 8306095fd2 "USB: Disable USB
3.0 LPM in critical sections."

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2012-07-11 07:06:46 -04:00
..
buffer.c USB: Core: Fix minor coding style issues 2011-01-22 19:35:39 -08:00
config.c usbcore: get BOS descriptor set 2011-09-26 15:51:08 -07:00
devices.c Revert "usb: move struct usb_device->children to struct usb_hub_port->child" 2012-05-14 09:20:37 -07:00
devio.c usbdevfs: Use scatter-gather lists for large bulk transfers 2012-07-06 10:53:20 -07:00
driver.c usb-core: Set intfdata to NULL if a driver's probe method failed 2012-06-13 16:07:22 -07:00
endpoint.c USB: use usb_endpoint_maxp() instead of le16_to_cpu() 2011-08-23 09:47:40 -07:00
file.c USB: rename the usb misc class from "usb" to "usbmisc" 2012-06-13 15:37:13 -07:00
generic.c USB: accept RNDIS configs if there's no alternative 2010-08-10 14:35:43 -07:00
hcd-pci.c USB: add NO_D3_DURING_SLEEP flag and revert 151b612847 2012-06-13 13:11:39 -07:00
hcd.c usb/hcd: Ensure scatter-gather is not used for isoc transfers 2012-07-09 09:46:50 -07:00
hub.c USB: Fix LPM disable/enable during device reset. 2012-07-11 07:06:46 -04:00
Kconfig usb: Kconfig: remove unneeded default value 2012-05-14 08:49:50 -07:00
Makefile usb: Bind devices to ACPI devices when possible 2012-05-11 17:06:13 -07:00
message.c Merge 3.5-rc3 into usb-next 2012-06-20 16:24:02 -07:00
notify.c usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:25 -04:00
otg_whitelist.h
quirks.c usb: add USB_QUIRK_RESET_RESUME for M-Audio 88es 2012-04-30 10:26:42 -04:00
sysfs.c USB: allow match on bInterfaceNumber 2012-06-13 15:40:09 -07:00
urb.c usbhid: prevent deadlock during timeout 2012-05-01 13:22:13 -04:00
usb-acpi.c usb: Set device removable state based on ACPI USB data 2012-05-11 17:07:02 -07:00
usb.c usb: fix breakage on systems without ACPI 2012-05-16 05:29:19 -07:00
usb.h usb: convert port_owners type from void * to struct dev_state * 2012-07-06 11:09:28 -07:00