diff options
author | Pratyush Anand <pratyush.anand@st.com> | 2014-07-04 17:01:27 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-07-09 15:41:34 -0700 |
commit | 51df62ff74b371866c1006dee887a8e42838c1f2 (patch) | |
tree | e0789766eef80b4adf66b4df57297380c55a9454 /drivers/usb/core | |
parent | b2f463e1300016785d63475c56f5807e2be00934 (diff) | |
download | lwn-51df62ff74b371866c1006dee887a8e42838c1f2.tar.gz lwn-51df62ff74b371866c1006dee887a8e42838c1f2.zip |
usb: allow lpm (en/dis)able only if device is atleast in default state
When a USB device is disconnected, usb_unbind_interface is called, which
tries to enable and disable LPM. usb_enable_lpm also try to send a
control command SET SEL to the device.
Since device is already disconnected, therefore it does not make sense
to execute usb_(en/dis)able_lpm.
This patch returns from usb_(en/dis)able_lpm, if device was not in
default state atleast.
Signed-off-by: Pratyush Anand <pratyush.anand@st.com>
Tested-by: Aymen Bouattay <aymen.bouattay@st.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/hub.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 21b99b4b4082..b90c6287bf47 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3860,7 +3860,8 @@ int usb_disable_lpm(struct usb_device *udev) if (!udev || !udev->parent || udev->speed != USB_SPEED_SUPER || - !udev->lpm_capable) + !udev->lpm_capable || + udev->state < USB_STATE_DEFAULT) return 0; hcd = bus_to_hcd(udev->bus); @@ -3916,7 +3917,8 @@ void usb_enable_lpm(struct usb_device *udev) if (!udev || !udev->parent || udev->speed != USB_SPEED_SUPER || - !udev->lpm_capable) + !udev->lpm_capable || + udev->state < USB_STATE_DEFAULT) return; udev->lpm_disable_count--; |