* [PATCH] pwm: img: stop using autosuspend on remove
@ 2026-09-18 3:30 Guangshuo Li
2026-11-30 11:44 ` Uwe Kleine-König
0 siblings, 1 reply; 5+ messages in thread
From: Guangshuo Li @ 2026-09-18 3:30 UTC (permalink / raw)
To: Uwe Kleine-König, Thierry Reding, Ed Blake, linux-pwm, linux-kernel
Cc: Guangshuo Li, stable
img_pwm_probe() enables runtime PM autosuspend with
pm_runtime_use_autosuspend(). The probe failure path disables
autosuspend again, but the remove path only disables runtime PM.
As a result, the runtime PM autosuspend setting is left enabled after
the driver is unbound.
Call pm_runtime_dont_use_autosuspend() from img_pwm_remove() to undo
the setting established during probe, matching the probe error path
and the runtime PM API requirements.
This issue was found by manual code inspection.
Fixes: e690ae526216 ("pwm: img: Add runtime PM")
Cc: stable@vger.kernel.org
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
---
drivers/pwm/pwm-img.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
index 91e0b19f0c08..c0747f5e0020 100644
--- a/drivers/pwm/pwm-img.c
+++ b/drivers/pwm/pwm-img.c
@@ -339,6 +339,7 @@ static void img_pwm_remove(struct platform_device *pdev)
struct pwm_chip *chip = platform_get_drvdata(pdev);
pm_runtime_disable(&pdev->dev);
+ pm_runtime_dont_use_autosuspend(&pdev->dev);
if (!pm_runtime_status_suspended(&pdev->dev))
img_pwm_runtime_suspend(&pdev->dev);
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pwm: img: stop using autosuspend on remove
2026-09-18 3:30 [PATCH] pwm: img: stop using autosuspend on remove Guangshuo Li
@ 2026-11-30 11:44 ` Uwe Kleine-König
2026-11-30 12:33 ` Joshua Crofts
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2026-11-30 11:44 UTC (permalink / raw)
To: Guangshuo Li
Cc: Thierry Reding, Ed Blake, linux-pwm, linux-kernel, stable,
Rafael J. Wysocki
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
Hello,
[adding Rafael as expert on runtime PM]
On Fri, Sep 18, 2026 at 11:30:17AM +0800, Guangshuo Li wrote:
> img_pwm_probe() enables runtime PM autosuspend with
> pm_runtime_use_autosuspend(). The probe failure path disables
> autosuspend again, but the remove path only disables runtime PM.
>
> As a result, the runtime PM autosuspend setting is left enabled after
> the driver is unbound.
>
> Call pm_runtime_dont_use_autosuspend() from img_pwm_remove() to undo
> the setting established during probe, matching the probe error path
> and the runtime PM API requirements.
>
> This issue was found by manual code inspection.
>
> Fixes: e690ae526216 ("pwm: img: Add runtime PM")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> drivers/pwm/pwm-img.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
> index 91e0b19f0c08..c0747f5e0020 100644
> --- a/drivers/pwm/pwm-img.c
> +++ b/drivers/pwm/pwm-img.c
> @@ -339,6 +339,7 @@ static void img_pwm_remove(struct platform_device *pdev)
> struct pwm_chip *chip = platform_get_drvdata(pdev);
>
> pm_runtime_disable(&pdev->dev);
> + pm_runtime_dont_use_autosuspend(&pdev->dev);
What is the effect of not having that? It that relevant at all with
runtime PM disabled? If the worst effect is that the device will have
autosuspend enabled when it's probed the next time, I think it's fine to
fix, but I'd drop the Cc: stable then.
Would it make sense to let pm_runtime_disable() call
pm_runtime_dont_use_autosuspend()?
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pwm: img: stop using autosuspend on remove
2026-11-30 11:44 ` Uwe Kleine-König
@ 2026-11-30 12:33 ` Joshua Crofts
2026-11-30 13:31 ` Uwe Kleine-König
0 siblings, 1 reply; 5+ messages in thread
From: Joshua Crofts @ 2026-11-30 12:33 UTC (permalink / raw)
To: ukleinek
Cc: ed.blake, lgs201920130244, linux-kernel, linux-pwm, rafael,
stable, thierry.reding
On Fri, Sep 18, 2026 at 11:30:17AM +0800, Guangshuo Li wrote:
> img_pwm_probe() enables runtime PM autosuspend with
> pm_runtime_use_autosuspend(). The probe failure path disables
> autosuspend again, but the remove path only disables runtime PM.
>
> As a result, the runtime PM autosuspend setting is left enabled after
> the driver is unbound.
>
> Call pm_runtime_dont_use_autosuspend() from img_pwm_remove() to undo
> the setting established during probe, matching the probe error path
> and the runtime PM API requirements.
>
> This issue was found by manual code inspection.
>
> Fixes: e690ae526216 ("pwm: img: Add runtime PM")
> Cc: stable@vger.kernel.org
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> drivers/pwm/pwm-img.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
> index 91e0b19f0c08..c0747f5e0020 100644
> --- a/drivers/pwm/pwm-img.c
> +++ b/drivers/pwm/pwm-img.c
> @@ -339,6 +339,7 @@ static void img_pwm_remove(struct platform_device *pdev)
> struct pwm_chip *chip = platform_get_drvdata(pdev);
>
> pm_runtime_disable(&pdev->dev);
> + pm_runtime_dont_use_autosuspend(&pdev->dev);
No need to add this as I added a change [1] that causes dont_use_autosuspend() to
be called on driver exit.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d1706f9da9f40dffe8621cc0ee03b847f41f1d6d
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pwm: img: stop using autosuspend on remove
2026-11-30 12:33 ` Joshua Crofts
@ 2026-11-30 13:31 ` Uwe Kleine-König
2026-11-30 13:41 ` Joshua Crofts
0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2026-11-30 13:31 UTC (permalink / raw)
To: Joshua Crofts
Cc: ed.blake, lgs201920130244, linux-kernel, linux-pwm, rafael,
stable, thierry.reding
[-- Attachment #1: Type: text/plain, Size: 1780 bytes --]
Hello,
On Mon, Nov 30, 2026 at 01:33:08PM +0100, Joshua Crofts wrote:
> On Fri, Sep 18, 2026 at 11:30:17AM +0800, Guangshuo Li wrote:
> > img_pwm_probe() enables runtime PM autosuspend with
> > pm_runtime_use_autosuspend(). The probe failure path disables
> > autosuspend again, but the remove path only disables runtime PM.
> >
> > As a result, the runtime PM autosuspend setting is left enabled after
> > the driver is unbound.
> >
> > Call pm_runtime_dont_use_autosuspend() from img_pwm_remove() to undo
> > the setting established during probe, matching the probe error path
> > and the runtime PM API requirements.
> >
> > This issue was found by manual code inspection.
> >
> > Fixes: e690ae526216 ("pwm: img: Add runtime PM")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> > ---
> > drivers/pwm/pwm-img.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/pwm/pwm-img.c b/drivers/pwm/pwm-img.c
> > index 91e0b19f0c08..c0747f5e0020 100644
> > --- a/drivers/pwm/pwm-img.c
> > +++ b/drivers/pwm/pwm-img.c
> > @@ -339,6 +339,7 @@ static void img_pwm_remove(struct platform_device *pdev)
> > struct pwm_chip *chip = platform_get_drvdata(pdev);
> >
> > pm_runtime_disable(&pdev->dev);
> > + pm_runtime_dont_use_autosuspend(&pdev->dev);
>
> No need to add this as I added a change [1] that causes dont_use_autosuspend() to
> be called on driver exit.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d1706f9da9f40dffe8621cc0ee03b847f41f1d6d
That sounds like the right thing to do. So I guess this patch can be
replaced by one that drops pm_runtime_dont_use_autosuspend() from
img_pwm_probe() then.
Best regards
Uwe
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] pwm: img: stop using autosuspend on remove
2026-11-30 13:31 ` Uwe Kleine-König
@ 2026-11-30 13:41 ` Joshua Crofts
0 siblings, 0 replies; 5+ messages in thread
From: Joshua Crofts @ 2026-11-30 13:41 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: ed.blake, lgs201920130244, linux-kernel, linux-pwm, rafael,
stable, thierry.reding
On 30-Nov-26 14:31, Uwe Kleine-König wrote:
>> > pm_runtime_disable(&pdev->dev);
>> > + pm_runtime_dont_use_autosuspend(&pdev->dev);
>>
>> No need to add this as I added a change [1] that causes dont_use_autosuspend() to
>> be called on driver exit.
>>
>> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d1706f9da9f40dffe8621cc0ee03b847f41f1d6d
>
> That sounds like the right thing to do. So I guess this patch can be
> replaced by one that drops pm_runtime_dont_use_autosuspend() from
> img_pwm_probe() then.
Correct. I've been sending series gradually to different subsystems but the
process has been slow; there are a few non-trivial cases of dont_use_autosuspend()
use that make it harder to remove.
I can send a quick patch to PWM removing it though, this is a trivial case.
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-30 13:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 3:30 [PATCH] pwm: img: stop using autosuspend on remove Guangshuo Li
2026-11-30 11:44 ` Uwe Kleine-König
2026-11-30 12:33 ` Joshua Crofts
2026-11-30 13:31 ` Uwe Kleine-König
2026-11-30 13:41 ` Joshua Crofts
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®