* [PATCH] PM: runtime: clarify pm_runtime_use_autosuspend() undo mechanism
@ 2026-10-27 12:20 Joshua Crofts
2026-10-27 16:03 ` Rafael J. Wysocki (Intel)
0 siblings, 1 reply; 2+ messages in thread
From: Joshua Crofts @ 2026-10-27 12:20 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Pavel Machek; +Cc: linux-pm, linux-kernel
Commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()")
introduced a pm_runtime_dont_use_autosuspend() call that is executed automatically
on driver exit without making any changes to the kerneldocs.
Update the kerneldocs to clarify the current mechanism of
pm_runtime_use_autosuspend() cleanup on exit.
Signed-off-by: Joshua Crofts <crofts@kernel.org>
---
Hi, would it be possible for this patch to go in a fix PR before 7.4 is
released to prevent any confusion about the mechanism of
pm_runtime_use_autosuspend()? Thanks!
---
Documentation/power/runtime_pm.rst | 10 +++++-----
include/linux/pm_runtime.h | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst
index e4407b687f8b..40a5c23d5259 100644
--- a/Documentation/power/runtime_pm.rst
+++ b/Documentation/power/runtime_pm.rst
@@ -425,11 +425,11 @@ but it also allows more flexibility in the handling of devices during the
removal of their drivers.
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. Alternatively, drivers can use
-devm_pm_runtime_enable() during probe, which automatically takes care of
-calling pm_runtime_disable() and pm_runtime_dont_use_autosuspend() upon driver
-detachment.
+in ->probe(). Usually this means calling pm_runtime_disable() etc.
+Alternatively, drivers can use devm_pm_runtime_enable() during probe, which
+automatically takes care of calling pm_runtime_disable() upon driver detachment.
+Any pm_runtime_use_autosuspend() calls in a driver will be automatically undone
+on driver exit.
The user space can effectively disallow the driver of the device to power manage
it at run time by changing the value of its /sys/devices/.../power/control
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 322e3b17f987..ae68a9dc7fc5 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -855,9 +855,9 @@ static inline void pm_runtime_disable(struct device *dev)
* requested (or "autosuspend" will be handled as direct runtime-suspend for
* it).
*
- * NOTE: It's important to undo this with pm_runtime_dont_use_autosuspend()
- * at driver exit time unless your driver initially enabled pm_runtime
- * with devm_pm_runtime_enable() (which handles it for you).
+ * NOTE: This is undone automatically with pm_runtime_dont_use_autosuspend() on
+ * driver exit regardless of whether a driver uses managed devm_* functions or
+ * not.
*/
static inline void pm_runtime_use_autosuspend(struct device *dev)
{
base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] PM: runtime: clarify pm_runtime_use_autosuspend() undo mechanism
2026-10-27 12:20 [PATCH] PM: runtime: clarify pm_runtime_use_autosuspend() undo mechanism Joshua Crofts
@ 2026-10-27 16:03 ` Rafael J. Wysocki (Intel)
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-10-27 16:03 UTC (permalink / raw)
To: Joshua Crofts
Cc: Rafael J . Wysocki, Len Brown, Pavel Machek, linux-pm,
linux-kernel
On Tue, Oct 27, 2026 at 1:21 PM Joshua Crofts <crofts@kernel.org> wrote:
>
> Commit d1706f9da9f4 ("PM: runtime: call pm_runtime_dont_use_autosuspend() on reinit()")
> introduced a pm_runtime_dont_use_autosuspend() call that is executed automatically
> on driver exit without making any changes to the kerneldocs.
>
> Update the kerneldocs to clarify the current mechanism of
> pm_runtime_use_autosuspend() cleanup on exit.
>
> Signed-off-by: Joshua Crofts <crofts@kernel.org>
> ---
> Hi, would it be possible for this patch to go in a fix PR before 7.4 is
> released to prevent any confusion about the mechanism of
> pm_runtime_use_autosuspend()? Thanks!
> ---
> Documentation/power/runtime_pm.rst | 10 +++++-----
> include/linux/pm_runtime.h | 6 +++---
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst
> index e4407b687f8b..40a5c23d5259 100644
> --- a/Documentation/power/runtime_pm.rst
> +++ b/Documentation/power/runtime_pm.rst
> @@ -425,11 +425,11 @@ but it also allows more flexibility in the handling of devices during the
> removal of their drivers.
>
> 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. Alternatively, drivers can use
> -devm_pm_runtime_enable() during probe, which automatically takes care of
> -calling pm_runtime_disable() and pm_runtime_dont_use_autosuspend() upon driver
> -detachment.
> +in ->probe(). Usually this means calling pm_runtime_disable() etc.
> +Alternatively, drivers can use devm_pm_runtime_enable() during probe, which
> +automatically takes care of calling pm_runtime_disable() upon driver detachment.
> +Any pm_runtime_use_autosuspend() calls in a driver will be automatically undone
> +on driver exit.
>
> The user space can effectively disallow the driver of the device to power manage
> it at run time by changing the value of its /sys/devices/.../power/control
> diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
> index 322e3b17f987..ae68a9dc7fc5 100644
> --- a/include/linux/pm_runtime.h
> +++ b/include/linux/pm_runtime.h
> @@ -855,9 +855,9 @@ static inline void pm_runtime_disable(struct device *dev)
> * requested (or "autosuspend" will be handled as direct runtime-suspend for
> * it).
> *
> - * NOTE: It's important to undo this with pm_runtime_dont_use_autosuspend()
> - * at driver exit time unless your driver initially enabled pm_runtime
> - * with devm_pm_runtime_enable() (which handles it for you).
> + * NOTE: This is undone automatically with pm_runtime_dont_use_autosuspend() on
> + * driver exit regardless of whether a driver uses managed devm_* functions or
> + * not.
> */
> static inline void pm_runtime_use_autosuspend(struct device *dev)
> {
>
> base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
> --
Applied as 7.4-rc material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-27 16:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 12:20 [PATCH] PM: runtime: clarify pm_runtime_use_autosuspend() undo mechanism Joshua Crofts
2026-10-27 16:03 ` Rafael J. Wysocki (Intel)
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.