[PATCH 13/13] PM: runtime: Drop pm_request_{idle,autosuspend}() return codes

From: Brian Norris

Date: Tue Oct 06 2026 - 19:28:29 EST


No in-tree callers (outside of KUnit tests) use the return values of
pm_request_idle() or pm_request_autosuspend().

As with pm_runtime_put() and pm_runtime_put_autosuspend(), these
functions asynchronously queue up a timer or work item to check whether
or not the device can be suspended, which is not guaranteed to succeed
and may return a negative error code in many valid situations (for
example, when user space has written "on" to the device's runtime PM
"control" file in sysfs, or when the device's usage counter is
non-zero).

Accordingly, change the return types of pm_request_idle() and
pm_request_autosuspend() to void, similar to commit 3afd8df02433 ("PM:
runtime: Change pm_runtime_put() return type to void").

Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
---
This patch is independent of the rest and could be applied on its own. I
put in this series because it has the same justification as the more
noisy one, "PM: runtime: Drop pm_runtime_put_autosuspend() return code"

drivers/base/power/runtime-test.c | 8 --------
include/linux/pm_runtime.h | 31 ++++---------------------------
2 files changed, 4 insertions(+), 35 deletions(-)

diff --git a/drivers/base/power/runtime-test.c b/drivers/base/power/runtime-test.c
index 24865ce844fc..ac3d7277e0c5 100644
--- a/drivers/base/power/runtime-test.c
+++ b/drivers/base/power/runtime-test.c
@@ -43,7 +43,6 @@ static void pm_runtime_already_suspended_test(struct kunit *test)

KUNIT_EXPECT_EQ(test, 1, pm_runtime_suspend(dev));
KUNIT_EXPECT_EQ(test, 1, pm_runtime_autosuspend(dev));
- KUNIT_EXPECT_EQ(test, 1, pm_request_autosuspend(dev));

pm_runtime_get_noresume(dev);
KUNIT_EXPECT_EQ(test, 1, pm_runtime_put_sync_autosuspend(dev));
@@ -81,7 +80,6 @@ static void pm_runtime_idle_test(struct kunit *test)
KUNIT_EXPECT_EQ(test, 0, pm_runtime_idle(dev));
KUNIT_EXPECT_TRUE(test, pm_runtime_suspended(dev));
KUNIT_EXPECT_EQ(test, -EAGAIN, pm_runtime_idle(dev));
- KUNIT_EXPECT_EQ(test, -EAGAIN, pm_request_idle(dev));
}

static void pm_runtime_disabled_test(struct kunit *test)
@@ -112,9 +110,7 @@ static void pm_runtime_disabled_test(struct kunit *test)

KUNIT_EXPECT_EQ(test, -EACCES, pm_runtime_resume_and_get(dev));
KUNIT_EXPECT_EQ(test, -EACCES, pm_runtime_idle(dev));
- KUNIT_EXPECT_EQ(test, -EACCES, pm_request_idle(dev));
KUNIT_EXPECT_EQ(test, -EACCES, pm_request_resume(dev));
- KUNIT_EXPECT_EQ(test, -EACCES, pm_request_autosuspend(dev));
KUNIT_EXPECT_EQ(test, -EACCES, pm_runtime_suspend(dev));
KUNIT_EXPECT_EQ(test, -EACCES, pm_runtime_resume(dev));
KUNIT_EXPECT_EQ(test, -EACCES, pm_runtime_autosuspend(dev));
@@ -154,9 +150,7 @@ static void pm_runtime_error_test(struct kunit *test)

KUNIT_EXPECT_EQ(test, -EINVAL, pm_runtime_resume_and_get(dev));
KUNIT_EXPECT_EQ(test, -EINVAL, pm_runtime_idle(dev));
- KUNIT_EXPECT_EQ(test, -EINVAL, pm_request_idle(dev));
KUNIT_EXPECT_EQ(test, -EINVAL, pm_request_resume(dev));
- KUNIT_EXPECT_EQ(test, -EINVAL, pm_request_autosuspend(dev));
KUNIT_EXPECT_EQ(test, -EINVAL, pm_runtime_suspend(dev));
KUNIT_EXPECT_EQ(test, -EINVAL, pm_runtime_resume(dev));
KUNIT_EXPECT_EQ(test, -EINVAL, pm_runtime_autosuspend(dev));
@@ -189,9 +183,7 @@ static void pm_runtime_error_test(struct kunit *test)
* (already resumed).
*/
KUNIT_EXPECT_EQ(test, -EAGAIN, pm_runtime_idle(dev));
- KUNIT_EXPECT_EQ(test, -EAGAIN, pm_request_idle(dev));
KUNIT_EXPECT_EQ(test, 1, pm_request_resume(dev));
- KUNIT_EXPECT_EQ(test, -EAGAIN, pm_request_autosuspend(dev));
KUNIT_EXPECT_EQ(test, -EAGAIN, pm_runtime_suspend(dev));
KUNIT_EXPECT_EQ(test, 1, pm_runtime_resume(dev));
KUNIT_EXPECT_EQ(test, -EAGAIN, pm_runtime_autosuspend(dev));
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index b0e7dfb3805f..418a51319a62 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -447,21 +447,10 @@ static inline int pm_runtime_resume(struct device *dev)
*
* Asynchronously request the PM core to evaluate whether @dev can be idled
* or suspended, invoking its ->runtime_idle() callback if provided.
- *
- * Return:
- * * %0: Success.
- * * %-EINVAL: Runtime PM error.
- * * %-EACCES: Runtime PM disabled.
- * * %-EAGAIN: Runtime PM usage counter non-zero, Runtime PM status change
- * ongoing or device not in %RPM_ACTIVE state.
- * * %-EBUSY: Runtime PM child_count non-zero.
- * * %-EPERM: Device PM QoS resume latency 0.
- * * %-EINPROGRESS: Suspend already in progress.
- * * %-ENOSYS: %CONFIG_PM not enabled.
*/
-static inline int pm_request_idle(struct device *dev)
+static inline void pm_request_idle(struct device *dev)
{
- return __pm_runtime_idle(dev, RPM_ASYNC);
+ __pm_runtime_idle(dev, RPM_ASYNC);
}

/**
@@ -487,23 +476,11 @@ static inline int pm_request_resume(struct device *dev)
*
* Update the last access time of @dev and asynchronously request the PM core
* to suspend it after the autosuspend delay has elapsed.
- *
- * Return:
- * * %1: Success; device was already suspended.
- * * %0: Success.
- * * %-EINVAL: Runtime PM error.
- * * %-EACCES: Runtime PM disabled.
- * * %-EAGAIN: Runtime PM usage counter non-zero or Runtime PM status change
- * ongoing.
- * * %-EBUSY: Runtime PM child_count non-zero.
- * * %-EPERM: Device PM QoS resume latency 0.
- * * %-EINPROGRESS: Suspend already in progress.
- * * %-ENOSYS: %CONFIG_PM not enabled.
*/
-static inline int pm_request_autosuspend(struct device *dev)
+static inline void pm_request_autosuspend(struct device *dev)
{
pm_runtime_mark_last_busy(dev);
- return __pm_runtime_suspend(dev, RPM_ASYNC | RPM_AUTO);
+ __pm_runtime_suspend(dev, RPM_ASYNC | RPM_AUTO);
}

/**
--
2.56.0.360.g66cac248cb-goog