From: Kai-Heng Feng <kai.heng.feng@canonical.com>
To: mathias.nyman@intel.com
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org (open list:USB XHCI DRIVER),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 1/2] xhci: Return if xHCI doesn't support LPM
Date: Wed, 20 May 2020 18:18:10 +0800 [thread overview]
Message-ID: <20200520101811.2623-1-kai.heng.feng@canonical.com> (raw)
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
next reply other threads:[~2020-05-20 10:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 10:18 Kai-Heng Feng [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200520101811.2623-1-kai.heng.feng@canonical.com \
--to=kai.heng.feng@canonical.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).