mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joshua Crofts <crofts@kernel.org>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Pavel Machek <pavel@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] PM: runtime: clarify pm_runtime_use_autosuspend() undo mechanism
Date: Tue, 27 Oct 2026 12:20:42 +0000	[thread overview]
Message-ID: <20261027122042.1444-1-crofts@kernel.org> (raw)

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


             reply	other threads:[~2026-10-27 12:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 12:20 Joshua Crofts [this message]
2026-10-27 16:03 ` Rafael J. Wysocki (Intel)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261027122042.1444-1-crofts@kernel.org \
    --to=crofts@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®