All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-usb@vger.kernel.org>, Peter Chen <peter.chen@nxp.com>,
	Mathias Nyman <mathias.nyman@linux.intel.com>
Subject: [PATCH 07/10] usb: xhci: omit duplicate actions when suspending a runtime suspended host.
Date: Fri, 18 Sep 2020 16:17:49 +0300	[thread overview]
Message-ID: <20200918131752.16488-8-mathias.nyman@linux.intel.com> (raw)
In-Reply-To: <20200918131752.16488-1-mathias.nyman@linux.intel.com>

From: Peter Chen <peter.chen@nxp.com>

If the xhci-plat.c is the platform driver, after the runtime pm is
enabled, the xhci_suspend is called if nothing is connected on
the port. When the system goes to suspend, it will call xhci_suspend again
if USB wakeup is enabled.

Since the runtime suspend wakeup setting is not always the same as
system suspend wakeup setting, eg, at runtime suspend we always need
wakeup if the controller is in low power mode; but at system suspend,
we may not need wakeup. So, we move the judgement after changing
wakeup setting.

[commit message rewording -Mathias]
Reviewed-by: Jun Li <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
 drivers/usb/host/xhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index f4cedcaee14b..4cfb95104c26 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -982,12 +982,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
 			xhci->shared_hcd->state != HC_STATE_SUSPENDED)
 		return -EINVAL;
 
-	xhci_dbc_suspend(xhci);
-
 	/* Clear root port wake on bits if wakeup not allowed. */
 	if (!do_wakeup)
 		xhci_disable_port_wake_on_bits(xhci);
 
+	if (!HCD_HW_ACCESSIBLE(hcd))
+		return 0;
+
+	xhci_dbc_suspend(xhci);
+
 	/* Don't poll the roothubs on bus suspend. */
 	xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
 	clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
-- 
2.17.1


  parent reply	other threads:[~2020-09-18 13:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 13:17 [PATCH 00/10] xhci features for usb-next Mathias Nyman
2020-09-18 13:17 ` [PATCH 01/10] usb: host: xhci-plat: add platform data support Mathias Nyman
2020-09-18 13:17 ` [PATCH 02/10] usb: host: xhci-plat: add .suspend_quirk for struct xhci_plat_priv Mathias Nyman
2020-09-18 13:17 ` [PATCH 03/10] usb: host: xhci-plat: delete the unnecessary code Mathias Nyman
2020-09-18 13:17 ` [PATCH 04/10] usb: host: xhci-plat: add priv quirk for skip PHY initialization Mathias Nyman
2020-09-18 13:17 ` [PATCH 05/10] usb: host: xhci-plat: add wakeup entry at sysfs Mathias Nyman
2020-09-18 13:17 ` [PATCH 06/10] usb: host: xhci-plat: improve the comments for xhci_plat_suspend Mathias Nyman
2020-09-18 13:17 ` Mathias Nyman [this message]
2020-09-18 13:17 ` [PATCH 08/10] xhci: Tune interrupt blocking for isochronous transfers Mathias Nyman
2020-09-18 13:17 ` [PATCH 09/10] xhci: don't create endpoint debugfs entry before ring buffer is set Mathias Nyman
2020-09-21 12:54   ` Sasha Levin
2020-09-18 13:17 ` [PATCH 10/10] usb: xhci: add debugfs support for ep with stream 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=20200918131752.16488-8-mathias.nyman@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@nxp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.