]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
usb: allow lpm (en/dis)able only if device is atleast in default state
authorPratyush Anand <pratyush.anand@st.com>
Fri, 4 Jul 2014 14:01:27 +0000 (17:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Jul 2014 22:41:34 +0000 (15:41 -0700)
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>
drivers/usb/core/hub.c

index 21b99b4b4082e5563430f464a9f8999bff03b0f4..b90c6287bf477a226502e7b0e63812cc25c4fe05 100644 (file)
@@ -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--;