Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"Frank.Li@nxp.com" <Frank.Li@nxp.com>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"festevam@gmail.com" <festevam@gmail.com>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"jun.li@nxp.com" <jun.li@nxp.com>
Subject: Re: [PATCH] usb: dwc3: imx: avoid calling imx suspend/resume callbacks twice
Date: Wed, 18 Mar 2026 01:18:29 +0000	[thread overview]
Message-ID: <20260318011828.u6cems56afut5hoz@synopsys.com> (raw)
In-Reply-To: <20260317030546.1665206-1-xu.yang_2@nxp.com>

On Tue, Mar 17, 2026, Xu Yang wrote:
> If a runtime suspend is executed followed by a system suspend, the driver
> may invoke dwc3_imx_suspend() twice, which causes enable_irq() to be
> called twice as well. This leads to an unbalanced IRQ state and may
> trigger warnings or malfunction. Prevent this by checking the pm_suspended
> flag before running the imx suspend/resume path.
> 
> Fixes: 76fc9452a6bf ("usb: dwc3: introduce flatten model driver of i.MX Soc")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  drivers/usb/dwc3/dwc3-imx.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-imx.c b/drivers/usb/dwc3/dwc3-imx.c
> index 303708f7d79a..973a486b544d 100644
> --- a/drivers/usb/dwc3/dwc3-imx.c
> +++ b/drivers/usb/dwc3/dwc3-imx.c
> @@ -288,6 +288,9 @@ static void dwc3_imx_remove(struct platform_device *pdev)
>  
>  static void dwc3_imx_suspend(struct dwc3_imx *dwc_imx, pm_message_t msg)
>  {
> +	if (dwc_imx->pm_suspended)
> +		return;
> +
>  	if (PMSG_IS_AUTO(msg) || device_may_wakeup(dwc_imx->dev))
>  		dwc3_imx_wakeup_enable(dwc_imx, msg);
>  
> @@ -299,6 +302,9 @@ static void dwc3_imx_resume(struct dwc3_imx *dwc_imx, pm_message_t msg)
>  {
>  	struct dwc3	*dwc = &dwc_imx->dwc;
>  
> +	if (!dwc_imx->pm_suspended)
> +		return;
> +
>  	dwc_imx->pm_suspended = false;
>  	if (!dwc_imx->wakeup_pending)
>  		disable_irq_nosync(dwc_imx->irq);
> -- 
> 2.34.1
> 

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>

BR,
Thinh

      reply	other threads:[~2026-03-18  1:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17  3:05 [PATCH] usb: dwc3: imx: avoid calling imx suspend/resume callbacks twice Xu Yang
2026-03-18  1:18 ` Thinh Nguyen [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=20260318011828.u6cems56afut5hoz@synopsys.com \
    --to=thinh.nguyen@synopsys.com \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=jun.li@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --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