Re: [PATCH] PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()

From: Rafael J. Wysocki (Intel)

Date: Fri Sep 25 2026 - 15:52:03 EST


On Sat, Sep 19, 2026 at 10:25 AM Joshua Crofts <joshua.crofts1@xxxxxxxxx> wrote:
>
> Add a pm_runtime_dont_use_autosuspend() call to pm_runtime_reinit() to
> ensure autosuspend is disabled on driver teardown.
>
> Suggested-by: Frank Li <Frank.Li@xxxxxxx>
> Signed-off-by: Joshua Crofts <joshua.crofts1@xxxxxxxxx>
> ---
> If a driver doesn't use devm_* functions for automatic cleanup on
> teardown and autosuspend is enabled during probe, it should also be
> disabled on teardown in a _remove() function or equivalent. However,
> due to bad documentation, driver authors usually omit the
> pm_runtime_dont_use_autosuspend() call on teardown.
>
> Reason for investigating: this week, several patches popped up in
> the linux-iio mailing list, adding these missing calls to several
> IIO drivers. For some reason I ended up writing a cocci script to
> find other instances of this and found ~195 offending drivers.
>
> After a discussion with Frank Li on the matter [1] when sending a similar
> patch adding these missing calls to the clk subsystem, we arrived to the
> idea of actually adding the dont_use_autosuspend() call to
> pm_runtime_reinit() and have driver core handle this instead of
> submitting 195+ patches to amend the issue.
>
> [1] https://lore.kernel.org/all/aq1N863eJpD_ZrLU@SMW015318/
> ---
> drivers/base/power/runtime.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index fab38bc98113..9a37f6162fe0 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -1874,6 +1874,9 @@ void pm_runtime_reinit(struct device *dev)
> if (dev->power.runtime_status == RPM_ACTIVE)
> pm_runtime_set_suspended(dev);
>
> + if (dev->power.use_autosuspend)
> + pm_runtime_dont_use_autosuspend(dev);
> +
> if (dev->power.irq_safe) {
> spin_lock_irq(&dev->power.lock);
> dev->power.irq_safe = 0;
>
> ---

Applied as 7.4 material, thanks!