mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Wang" <00107082@163.com>
To: mathias.nyman@intel.com, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re:[PATCH] usb: xhci: wait for controller ready when resume with reinit_xhc
Date: Mon, 2 Sep 2024 01:01:07 +0800 (CST)	[thread overview]
Message-ID: <1fe3e185.3639.191ae88840f.Coremail.00107082@163.com> (raw)
In-Reply-To: <20240901162425.5103-1-00107082@163.com>

Oops... Just find out the warning "  ep_81: PM: parent 3-1.1:1.1 should not be sleeping" shows up when I suspend my system with USB camera on, 
and this patch could not fix it.
Please ignore the patch, sorry bothering...

David


At 2024-09-02 00:24:25, "David Wang" <00107082@163.com> wrote:
>When resume system with reinit_xhc true, PM would report kernel
>warning about device parent:
>
> >usb 3-1.1: reset high-speed USB device number 4 using xhci_hcd
> >..
> >ep_81: PM: parent 3-1.1:1.1 should not be sleeping
>
>Move the code waiting for controller ready out, and make it
>carry out work no matter reinit_xhc is true or false.
>The error is ignored when reinit_xhc is true.
>
>Signed-off-by: David Wang <00107082@163.com>
>---
> drivers/usb/host/xhci.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
>index efdf4c228b8c..8aeb1b34cdbf 100644
>--- a/drivers/usb/host/xhci.c
>+++ b/drivers/usb/host/xhci.c
>@@ -1032,13 +1032,15 @@ int xhci_resume(struct xhci_hcd *xhci, pm_message_t msg)
> 	if (hibernated || xhci->quirks & XHCI_RESET_ON_RESUME || xhci->broken_suspend)
> 		reinit_xhc = true;
> 
>+	/*
>+	 * Some controllers might lose power during suspend, so wait
>+	 * for controller not ready bit to clear, just as in xHC init.
>+	 * Ignore retval if reinit_xhc is true, since the device would
>+	 * be reinited.
>+	 */
>+	retval = xhci_handshake(&xhci->op_regs->status,
>+				STS_CNR, 0, 10 * 1000 * 1000);
> 	if (!reinit_xhc) {
>-		/*
>-		 * Some controllers might lose power during suspend, so wait
>-		 * for controller not ready bit to clear, just as in xHC init.
>-		 */
>-		retval = xhci_handshake(&xhci->op_regs->status,
>-					STS_CNR, 0, 10 * 1000 * 1000);
> 		if (retval) {
> 			xhci_warn(xhci, "Controller not ready at resume %d\n",
> 				  retval);
>-- 
>2.39.2

      reply	other threads:[~2024-09-01 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-01 16:24 [PATCH] " David Wang
2024-09-01 17:01 ` David Wang [this message]

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=1fe3e185.3639.191ae88840f.Coremail.00107082@163.com \
    --to=00107082@163.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

all inboxes | Powered by JetHome®