public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spi: imx: fix runtime pm leak on probe deferral
@ 2026-04-21 12:56 Johan Hovold
  2026-04-22  3:32 ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2026-04-21 12:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: Frank Li, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-spi, imx, linux-kernel, Johan Hovold, stable

Make sure to balance the runtime PM usage count before returning on
probe failure (e.g. probe deferral) so that the controller can be
suspended when a driver is later bound.

Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
Cc: stable@vger.kernel.org	# 5.10
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/spi/spi-imx.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index 4747899e0646..e5c907c45b87 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
 out_runtime_pm_put:
 	pm_runtime_dont_use_autosuspend(spi_imx->dev);
 	pm_runtime_disable(spi_imx->dev);
+	pm_runtime_put_noidle(spi_imx->dev);
 	pm_runtime_set_suspended(&pdev->dev);
 
 	clk_disable_unprepare(spi_imx->clk_ipg);
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: imx: fix runtime pm leak on probe deferral
  2026-04-21 12:56 [PATCH] spi: imx: fix runtime pm leak on probe deferral Johan Hovold
@ 2026-04-22  3:32 ` Frank Li
  2026-04-22  6:47   ` Johan Hovold
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Li @ 2026-04-22  3:32 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Mark Brown, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-spi, imx, linux-kernel, stable

On Tue, Apr 21, 2026 at 02:56:32PM +0200, Johan Hovold wrote:
> Make sure to balance the runtime PM usage count before returning on
> probe failure (e.g. probe deferral) so that the controller can be
> suspended when a driver is later bound.
>
> Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
> Cc: stable@vger.kernel.org	# 5.10
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/spi/spi-imx.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index 4747899e0646..e5c907c45b87 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
>  out_runtime_pm_put:
>  	pm_runtime_dont_use_autosuspend(spi_imx->dev);
>  	pm_runtime_disable(spi_imx->dev);
> +	pm_runtime_put_noidle(spi_imx->dev);

use devm_pm_runtime_get_noresume() and  devm_pm_runtime_enable() to
fix this problem

Frank
>  	pm_runtime_set_suspended(&pdev->dev);
>
>  	clk_disable_unprepare(spi_imx->clk_ipg);
> --
> 2.52.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: imx: fix runtime pm leak on probe deferral
  2026-04-22  3:32 ` Frank Li
@ 2026-04-22  6:47   ` Johan Hovold
  2026-04-22  7:34     ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: Johan Hovold @ 2026-04-22  6:47 UTC (permalink / raw)
  To: Frank Li
  Cc: Mark Brown, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-spi, imx, linux-kernel, stable

On Tue, Apr 21, 2026 at 11:32:48PM -0400, Frank Li wrote:
> On Tue, Apr 21, 2026 at 02:56:32PM +0200, Johan Hovold wrote:
> > Make sure to balance the runtime PM usage count before returning on
> > probe failure (e.g. probe deferral) so that the controller can be
> > suspended when a driver is later bound.
> >
> > Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
> > Cc: stable@vger.kernel.org	# 5.10
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Signed-off-by: Johan Hovold <johan@kernel.org>
> > ---
> >  drivers/spi/spi-imx.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> > index 4747899e0646..e5c907c45b87 100644
> > --- a/drivers/spi/spi-imx.c
> > +++ b/drivers/spi/spi-imx.c
> > @@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
> >  out_runtime_pm_put:
> >  	pm_runtime_dont_use_autosuspend(spi_imx->dev);
> >  	pm_runtime_disable(spi_imx->dev);
> > +	pm_runtime_put_noidle(spi_imx->dev);
> 
> use devm_pm_runtime_get_noresume() and  devm_pm_runtime_enable() to
> fix this problem

No. The first helper you mentioned was only added a year ago and does
not even solve the issue without rewriting larger parts of the driver.

So that would need to be a separate change in any case.

Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] spi: imx: fix runtime pm leak on probe deferral
  2026-04-22  6:47   ` Johan Hovold
@ 2026-04-22  7:34     ` Frank Li
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-04-22  7:34 UTC (permalink / raw)
  To: Johan Hovold
  Cc: Mark Brown, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	linux-spi, imx, linux-kernel, stable

On Wed, Apr 22, 2026 at 08:47:57AM +0200, Johan Hovold wrote:
> On Tue, Apr 21, 2026 at 11:32:48PM -0400, Frank Li wrote:
> > On Tue, Apr 21, 2026 at 02:56:32PM +0200, Johan Hovold wrote:
> > > Make sure to balance the runtime PM usage count before returning on
> > > probe failure (e.g. probe deferral) so that the controller can be
> > > suspended when a driver is later bound.
> > >
> > > Fixes: 43b6bf406cd0 ("spi: imx: fix runtime pm support for !CONFIG_PM")
> > > Cc: stable@vger.kernel.org	# 5.10
> > > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > > Signed-off-by: Johan Hovold <johan@kernel.org>
> > > ---
> > >  drivers/spi/spi-imx.c | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> > > index 4747899e0646..e5c907c45b87 100644
> > > --- a/drivers/spi/spi-imx.c
> > > +++ b/drivers/spi/spi-imx.c
> > > @@ -2373,6 +2373,7 @@ static int spi_imx_probe(struct platform_device *pdev)
> > >  out_runtime_pm_put:
> > >  	pm_runtime_dont_use_autosuspend(spi_imx->dev);
> > >  	pm_runtime_disable(spi_imx->dev);
> > > +	pm_runtime_put_noidle(spi_imx->dev);
> >
> > use devm_pm_runtime_get_noresume() and  devm_pm_runtime_enable() to
> > fix this problem
>
> No. The first helper you mentioned was only added a year ago and does
> not even solve the issue without rewriting larger parts of the driver.
>
> So that would need to be a separate change in any case.

It should be less 10 line code changes. separate change is okay, but suggest
create following patches for this also.

Frank

>
> Johan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-22  7:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 12:56 [PATCH] spi: imx: fix runtime pm leak on probe deferral Johan Hovold
2026-04-22  3:32 ` Frank Li
2026-04-22  6:47   ` Johan Hovold
2026-04-22  7:34     ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox