Re: [PATCH] PM: runtime: Have devm_pm_runtime_enable() handle pm_runtime_dont_use_autosuspend()
From: Rafael J. Wysocki
Date: Fri Mar 04 2022 - 12:31:05 EST
On Fri, Mar 4, 2022 at 11:04 AM Ulf Hansson <ulf.hansson@xxxxxxxxxx> wrote:
>
> On Wed, 23 Feb 2022 at 17:35, Douglas Anderson <dianders@xxxxxxxxxxxx> wrote:
> >
> > The PM Runtime docs say:
> > Drivers in ->remove() callback should undo the runtime PM changes done
> > in ->probe(). Usually this means calling pm_runtime_disable(),
> > pm_runtime_dont_use_autosuspend() etc.
> >
> > From grepping code, it's clear that many people aren't aware of the
> > need to call pm_runtime_dont_use_autosuspend().
> >
> > When brainstorming solutions, one idea that came up was to leverage
> > the new-ish devm_pm_runtime_enable() function. The idea here is that:
> > * When the devm action is called we know that the driver is being
> > removed. It's the perfect time to undo the use_autosuspend.
> > * The code of pm_runtime_dont_use_autosuspend() already handles the
> > case of being called when autosuspend wasn't enabled.
> >
> > Suggested-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
>
> Okay, this provides an improvement from the short term perspective.
I agree.
> Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
And so I've queued up the patch (for 5.18).
Thanks!