mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove
@ 2026-09-14 11:34 Guangshuo Li
  2026-09-14 12:53 ` Joshua Crofts
  2026-09-15 11:07 ` Krzysztof Kozlowski
  0 siblings, 2 replies; 4+ messages in thread
From: Guangshuo Li @ 2026-09-14 11:34 UTC (permalink / raw)
  To: Eugen Hristev, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-iio, linux-arm-kernel, linux-kernel
  Cc: Guangshuo Li, stable

at91_adc_probe() enables runtime PM autosuspend with
pm_runtime_use_autosuspend(). The probe error path correctly undoes
this setting with pm_runtime_dont_use_autosuspend(), but the normal
remove path only disables runtime PM.

The runtime PM API requires pm_runtime_use_autosuspend() to be undone
with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM
was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag
set therefore leaves the runtime PM state incompletely cleaned up after
the driver is unbound.

Add the missing pm_runtime_dont_use_autosuspend() call to the remove
path.

This issue was found by manual code inspection.

Fixes: 75d7556ac0e4 ("iio: adc: at91-sama5d2_adc: add runtime pm support")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
 drivers/iio/adc/at91-sama5d2_adc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
index e8a5285bb6d4..e68632e628c7 100644
--- a/drivers/iio/adc/at91-sama5d2_adc.c
+++ b/drivers/iio/adc/at91-sama5d2_adc.c
@@ -2487,6 +2487,7 @@ static void at91_adc_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(st->dev);
 	pm_runtime_set_suspended(st->dev);
+	pm_runtime_dont_use_autosuspend(st->dev);
 	clk_disable_unprepare(st->per_clk);
 
 	regulator_disable(st->vref);
-- 
2.43.0


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

* Re: [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove
  2026-09-14 11:34 [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove Guangshuo Li
@ 2026-09-14 12:53 ` Joshua Crofts
  2026-09-17  3:11   ` Jonathan Cameron
  2026-09-15 11:07 ` Krzysztof Kozlowski
  1 sibling, 1 reply; 4+ messages in thread
From: Joshua Crofts @ 2026-09-14 12:53 UTC (permalink / raw)
  To: Guangshuo Li
  Cc: Eugen Hristev, Jonathan Cameron, David Lechner, Nuno Sá,
	Andy Shevchenko, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-iio, linux-arm-kernel, linux-kernel,
	stable

On Mon, 14 Sep 2026 19:34:22 +0800
Guangshuo Li <lgs201920130244@gmail.com> wrote:

> at91_adc_probe() enables runtime PM autosuspend with
> pm_runtime_use_autosuspend(). The probe error path correctly undoes
> this setting with pm_runtime_dont_use_autosuspend(), but the normal
> remove path only disables runtime PM.
> 
> The runtime PM API requires pm_runtime_use_autosuspend() to be undone
> with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM
> was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag
> set therefore leaves the runtime PM state incompletely cleaned up after
> the driver is unbound.
> 
> Add the missing pm_runtime_dont_use_autosuspend() call to the remove
> path.
> 
> This issue was found by manual code inspection.
> 
> Fixes: 75d7556ac0e4 ("iio: adc: at91-sama5d2_adc: add runtime pm support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/iio/adc/at91-sama5d2_adc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> index e8a5285bb6d4..e68632e628c7 100644
> --- a/drivers/iio/adc/at91-sama5d2_adc.c
> +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> @@ -2487,6 +2487,7 @@ static void at91_adc_remove(struct platform_device *pdev)
>  
>  	pm_runtime_disable(st->dev);
>  	pm_runtime_set_suspended(st->dev);
> +	pm_runtime_dont_use_autosuspend(st->dev);
>  	clk_disable_unprepare(st->per_clk);
>  
>  	regulator_disable(st->vref);

Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>

-- 
Kind regards,
Joshua Crofts

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

* Re: [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove
  2026-09-14 11:34 [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove Guangshuo Li
  2026-09-14 12:53 ` Joshua Crofts
@ 2026-09-15 11:07 ` Krzysztof Kozlowski
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-15 11:07 UTC (permalink / raw)
  To: Guangshuo Li, Eugen Hristev, Jonathan Cameron, David Lechner,
	Nuno Sá,
	Andy Shevchenko, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-iio, linux-arm-kernel, linux-kernel
  Cc: stable

On 14/09/2026 13:34, Guangshuo Li wrote:
> at91_adc_probe() enables runtime PM autosuspend with
> pm_runtime_use_autosuspend(). The probe error path correctly undoes
> this setting with pm_runtime_dont_use_autosuspend(), but the normal
> remove path only disables runtime PM.
> 
> The runtime PM API requires pm_runtime_use_autosuspend() to be undone
> with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM
> was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag
> set therefore leaves the runtime PM state incompletely cleaned up after
> the driver is unbound.
> 
> Add the missing pm_runtime_dont_use_autosuspend() call to the remove
> path.
> 
> This issue was found by manual code inspection.
> 
> Fixes: 75d7556ac0e4 ("iio: adc: at91-sama5d2_adc: add runtime pm support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>

Nothing improved, you again spammed with multiple independent patches so
maintainers would need to respond TO EACH one instead of to the thread.

Best regards,
Krzysztof

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

* Re: [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove
  2026-09-14 12:53 ` Joshua Crofts
@ 2026-09-17  3:11   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2026-09-17  3:11 UTC (permalink / raw)
  To: Joshua Crofts
  Cc: Guangshuo Li, Eugen Hristev, David Lechner, Nuno Sá,
	Andy Shevchenko, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-iio, linux-arm-kernel, linux-kernel,
	stable

On Mon, 14 Sep 2026 14:53:39 +0200
Joshua Crofts <joshua.crofts1@gmail.com> wrote:

> On Mon, 14 Sep 2026 19:34:22 +0800
> Guangshuo Li <lgs201920130244@gmail.com> wrote:
> 
> > at91_adc_probe() enables runtime PM autosuspend with
> > pm_runtime_use_autosuspend(). The probe error path correctly undoes
> > this setting with pm_runtime_dont_use_autosuspend(), but the normal
> > remove path only disables runtime PM.
> > 
> > The runtime PM API requires pm_runtime_use_autosuspend() to be undone
> > with pm_runtime_dont_use_autosuspend() at driver exit unless runtime PM
> > was enabled with devm_pm_runtime_enable(). Leaving the autosuspend flag
> > set therefore leaves the runtime PM state incompletely cleaned up after
> > the driver is unbound.
> > 
> > Add the missing pm_runtime_dont_use_autosuspend() call to the remove
> > path.
> > 
> > This issue was found by manual code inspection.
> > 
> > Fixes: 75d7556ac0e4 ("iio: adc: at91-sama5d2_adc: add runtime pm support")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> > ---
> >  drivers/iio/adc/at91-sama5d2_adc.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c
> > index e8a5285bb6d4..e68632e628c7 100644
> > --- a/drivers/iio/adc/at91-sama5d2_adc.c
> > +++ b/drivers/iio/adc/at91-sama5d2_adc.c
> > @@ -2487,6 +2487,7 @@ static void at91_adc_remove(struct platform_device *pdev)
> >  
> >  	pm_runtime_disable(st->dev);
> >  	pm_runtime_set_suspended(st->dev);
> > +	pm_runtime_dont_use_autosuspend(st->dev);
> >  	clk_disable_unprepare(st->per_clk);
> >  
> >  	regulator_disable(st->vref);  
> 
> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Applied.

Please make sure to take into account both Joshua and Krzystof's
feedback that multiple near identical changes to drivers in the
same subsystem should be in a series.

Thanks,

Jonathan

> 


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

end of thread, other threads:[~2026-09-17  3:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 11:34 [PATCH] iio: adc: at91-sama5d2: disable autosuspend on remove Guangshuo Li
2026-09-14 12:53 ` Joshua Crofts
2026-09-17  3:11   ` Jonathan Cameron
2026-09-15 11:07 ` Krzysztof Kozlowski

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®