[PATCH 08/11] PM: runtime: Clarify driver callback expectations and structure Section 2
From: Brian Norris <briannorris@chromium.org>
Date: 2026-09-04 21:20:39
Also in:
lkml
Subsystem:
suspend to ram, the rest · Maintainers:
"Rafael J. Wysocki", Linus Torvalds
Section 2 describes the three runtime callbacks, but: 1) it's fairly dense to read (150+ lines); and 2) it glosses over a big point -- that it's uncommon for drivers to implement ->runtime_idle() Add a note up-front to help direct the reader about #2, and add headings to try to break up the text a bit. Signed-off-by: Brian Norris <briannorris@chromium.org> --- Documentation/power/runtime_pm.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/Documentation/power/runtime_pm.rst b/Documentation/power/runtime_pm.rst
index 334fbdcd8fd6..571a2f29851b 100644
--- a/Documentation/power/runtime_pm.rst
+++ b/Documentation/power/runtime_pm.rst@@ -99,6 +99,14 @@ There are three device runtime PM callbacks defined in 'struct dev_pm_ops':: ... }; +Most device drivers only need to implement ->runtime_suspend() and +->runtime_resume(). The ->runtime_idle() callback is optional and rarely +implemented by peripheral device drivers, as the PM core automatically handles +suspension and autosuspend when ->runtime_idle() is omitted (or returns 0). + +Subsystem and Driver Callbacks +------------------------------ + The ->runtime_suspend(), ->runtime_resume() and ->runtime_idle() callbacks are executed by the PM core for the device's subsystem that may be either of the following:
@@ -132,6 +140,9 @@ not block or sleep, but it also means that the synchronous helper functions listed at the end of Section 4 may be used for that device within an interrupt handler or generally in an atomic context. +Callback Semantics +------------------ + The subsystem-level suspend callback, if present, is _entirely_ _responsible_ for handling the suspend of the device as appropriate, which may, but need not include executing the device driver's own ->runtime_suspend() callback (from the
@@ -212,6 +223,9 @@ return a non-zero value (typically -EBUSY or -EAGAIN). Unlike return codes from ->runtime_idle() as a fatal device error; any non-zero value simply stops the PM core from suspending the device. +Core Guarantees and Synchronization Rules +----------------------------------------- + The helper functions provided by the PM core, described in Section 4, guarantee that the following constraints are met with respect to runtime PM callbacks for one device:
--
2.55.0.979.g7e5102b832-goog