linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Ryan Zhou <ryanzhou54@gmail.com>,
	 "stern@rowland.harvard.edu" <stern@rowland.harvard.edu>,
	 "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	 "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	 "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	 "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"rafael@kernel.org" <rafael@kernel.org>,
	 "royluo@google.com" <royluo@google.com>
Subject: Re: [PATCH v2] drvier: usb: dwc3: Fix runtime PM trying to activate child device xxx.dwc3 but parent is not active
Date: Thu, 11 Sep 2025 13:35:59 +0200	[thread overview]
Message-ID: <CAJZ5v0gT26VK-sHmgK_S4RjjO3Uc-ZmoAYos43S5yWh0zWc9DA@mail.gmail.com> (raw)
In-Reply-To: <xbfvykzfi26pyaycd7efbqvmraxcu6zzgqjfxtk33wcsjsnnal@5e3g4pq5qcj3>

On Thu, Sep 11, 2025 at 12:58 PM Xu Yang <xu.yang_2@nxp.com> wrote:
>
> Hi Ryan,
>
> On Thu, Sep 11, 2025 at 01:32:47AM +0000, Thinh Nguyen wrote:
> > On Wed, Sep 10, 2025, Ryan Zhou wrote:
> > > Issue description:During the wake-up sequence, if the system invokes
> > >  dwc3->resume and detects that the parent device of dwc3 is in a
> > > runtime suspend state, the system will generate an error: runtime PM
> > > trying to activate child device xxx.dwc3 but parent is not active.
> > >
> > > Solution:At the dwc3->resume entry point, if the dwc3 controller
> > > is detected in a suspended state, the function shall return
> > > immediately without executing any further operations.
> > >
> > > Signed-off-by: Ryan Zhou <ryanzhou54@gmail.com>
> > > ---
> > >  drivers/usb/dwc3/core.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> > > index 370fc524a468..06a6f8a67129 100644
> > > --- a/drivers/usb/dwc3/core.c
> > > +++ b/drivers/usb/dwc3/core.c
> > > @@ -2687,6 +2687,9 @@ int dwc3_pm_resume(struct dwc3 *dwc)
> > >     struct device *dev = dwc->dev;
> > >     int             ret = 0;
> > >
> > > +   if (pm_runtime_suspended(dev))
> > > +           return ret;
> > > +
> >
> > Is this a documented behavior where the device should remain runtime
> > suspend on system resume? I feel that that this should be configurable
> > by the user or defined the PM core. I don't think we should change
> > default behavior here just to workaround the issue that we're facing.
> >
> > What if the user wants to keep the old behavior and resume up the device
> > on system resume?
>
> What about resume the device firstly if it's already runtime suspended when
> call dwc3_pm_suspend(). Therefor, the old behavior can be kept and the issue
> can be avoided.
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 370fc524a468..1b8dbb260017 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -2672,6 +2672,9 @@ int dwc3_pm_suspend(struct dwc3 *dwc)
>         struct device *dev = dwc->dev;
>         int             ret;
>
> +       if (pm_runtime_suspended(dev))
> +               pm_runtime_resume(dev);

You can just call pm_runtime_resume() here without the preliminary check.

> +
>         ret = dwc3_suspend_common(dwc, PMSG_SUSPEND);
>         if (ret)
>                 return ret;
>
> Thanks,
> Xu Yang
>
> >
> > BR,
> > Thinh
> >
> > >     pinctrl_pm_select_default_state(dev);
> > >
> > >     pm_runtime_disable(dev);
> > > --

  reply	other threads:[~2025-09-11 11:36 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 15:08 [PATCH] drvier: usb: dwc3: Fix runtime PM trying to activate child device xxx.dwc3 but parent is not active Ryan Zhou
2025-08-26 18:38 ` Roy Luo
2025-08-27 14:09   ` ryan zhou
2025-08-27 14:52     ` Alan Stern
2025-08-27 18:56       ` Rafael J. Wysocki
2025-08-29  0:43         ` Thinh Nguyen
2025-08-29  1:25           ` Alan Stern
2025-08-29 19:07             ` Thinh Nguyen
2025-08-29 19:26               ` Rafael J. Wysocki
2025-08-29 20:13                 ` Thinh Nguyen
2025-08-30  0:46                   ` Alan Stern
2025-08-30  1:14                     ` Thinh Nguyen
2025-08-29 19:23             ` Rafael J. Wysocki
2025-08-29 19:58               ` Alan Stern
2025-09-01 19:41                 ` Rafael J. Wysocki
2025-09-01 20:40                   ` Rafael J. Wysocki
2025-09-02  2:41                     ` Alan Stern
2025-09-03 11:51                       ` ryan zhou
2025-09-03 19:30                       ` Rafael J. Wysocki
2025-09-03 21:54                         ` Alan Stern
2025-09-04 14:08                           ` Rafael J. Wysocki
2025-09-04 14:19                             ` Alan Stern
2025-09-04 14:33                               ` Rafael J. Wysocki
2025-09-04 17:34                               ` Rafael J. Wysocki
2025-09-04 18:54                                 ` Alan Stern
2025-09-09 16:19                                   ` [PATCH v2] " Ryan Zhou
2025-09-09 16:25                                     ` Greg KH
2025-09-10 12:26                                       ` [PATCH v3] " Ryan Zhou
2025-09-10 12:56                                       ` [PATCH v2] " ryan zhou
2025-09-10 13:07                                         ` Greg KH
2025-09-11 13:25                                           ` ryan zhou
2025-09-11  1:32                                     ` Thinh Nguyen
2025-09-11 10:52                                       ` Xu Yang
2025-09-11 11:35                                         ` Rafael J. Wysocki [this message]
2025-09-11 13:56                                           ` ryan zhou
2025-09-11 13:58                                             ` Rafael J. Wysocki
2025-09-12  7:51                                           ` Xu Yang
2025-09-12 21:38                                             ` Thinh Nguyen
2025-09-11 13:51                                         ` ryan zhou
2025-09-12  7:49                                           ` Xu Yang
2025-09-11 13:40                                       ` ryan zhou
2025-09-12 21:36                                         ` Thinh Nguyen
2025-09-12 22:23                                   ` [PATCH] " Thinh Nguyen
2025-09-13 12:43                                     ` Rafael J. Wysocki

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=CAJZ5v0gT26VK-sHmgK_S4RjjO3Uc-ZmoAYos43S5yWh0zWc9DA@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=royluo@google.com \
    --cc=ryanzhou54@gmail.com \
    --cc=stern@rowland.harvard.edu \
    --cc=xu.yang_2@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 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).