提交 51df62ff 编写于 作者: P Pratyush Anand 提交者: Greg Kroah-Hartman

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: NPratyush Anand <pratyush.anand@st.com>
Tested-by: NAymen Bouattay <aymen.bouattay@st.com>
Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b2f463e1
......@@ -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--;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册