linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xhci: Return if xHCI doesn't support LPM
@ 2020-05-20 10:18 Kai-Heng Feng
  2020-05-20 10:18 ` [PATCH 2/2] xhci: Poll for U0 after disabling USB2 LPM Kai-Heng Feng
  0 siblings, 1 reply; 8+ messages in thread
From: Kai-Heng Feng @ 2020-05-20 10:18 UTC (permalink / raw)
  To: mathias.nyman
  Cc: Kai-Heng Feng, Greg Kroah-Hartman, open list:USB XHCI DRIVER, open list

Just return if xHCI is quirked to disable LPM. We can save some time
from reading registers and doing spinlocks.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/host/xhci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index bee5deccc83d..14181a7ea375 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4390,6 +4390,9 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
 	int		hird, exit_latency;
 	int		ret;
 
+	if (xhci->quirks & XHCI_HW_LPM_DISABLE)
+		return -EPERM;
+
 	if (hcd->speed >= HCD_USB3 || !xhci->hw_lpm_support ||
 			!udev->lpm_capable)
 		return -EPERM;
@@ -4412,7 +4415,7 @@ static int xhci_set_usb2_hardware_lpm(struct usb_hcd *hcd,
 	xhci_dbg(xhci, "%s port %d USB2 hardware LPM\n",
 			enable ? "enable" : "disable", port_num + 1);
 
-	if (enable && !(xhci->quirks & XHCI_HW_LPM_DISABLE)) {
+	if (enable) {
 		/* Host supports BESL timeout instead of HIRD */
 		if (udev->usb2_hw_lpm_besl_capable) {
 			/* if device doesn't have a preferred BESL value use a
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-23  8:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-20 10:18 [PATCH 1/2] xhci: Return if xHCI doesn't support LPM Kai-Heng Feng
2020-05-20 10:18 ` [PATCH 2/2] xhci: Poll for U0 after disabling USB2 LPM Kai-Heng Feng
2020-06-08  3:58   ` Kai-Heng Feng
2020-06-08  7:05     ` Greg Kroah-Hartman
2020-06-08 11:21   ` Mathias Nyman
2020-06-09 10:15     ` Kai-Heng Feng
2020-06-19 14:19       ` Kai-Heng Feng
2020-06-23  8:38         ` Mathias Nyman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).