[PATCH 12/13] PM: runtime: Drop pm_runtime_put_autosuspend() return code
From: Brian Norris
Date: Tue Oct 06 2026 - 19:28:03 EST
The primary role of pm_runtime_put_autosuspend() is to update the last
access time and decrement the runtime PM usage counter of the given
device. It always does that regardless of the value returned by it
later.
In addition, if the runtime PM usage counter after decrementation turns
out to be zero, a timer or work item is queued up to check whether or
not the device can be suspended once its autosuspend delay has elapsed.
This is not guaranteed to succeed though and even if it is successful,
the device may still not be suspended going forward.
There are multiple valid reasons why pm_runtime_put_autosuspend() may
not decide to queue up the timer or work item mentioned above,
including, but not limited to, the case when user space has written
"on" to the device's runtime PM "control" file in sysfs. In some of
those cases, pm_runtime_put_autosuspend() returns a negative error code
(even though the device's runtime PM usage counter has been successfully
decremented by it) which is very confusing.
Accordingly, to avoid the confusion mentioned above, change the return
types of pm_runtime_put_autosuspend() and __pm_runtime_put_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 must be applied after all the preceding patches. Presumably
that can wait for other maintainers.
include/linux/pm_runtime.h | 32 ++++----------------------------
1 file changed, 4 insertions(+), 28 deletions(-)
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h
index 322e3b17f987..b0e7dfb3805f 100644
--- a/include/linux/pm_runtime.h
+++ b/include/linux/pm_runtime.h
@@ -593,22 +593,10 @@ static inline void pm_runtime_put(struct device *dev)
*
* Decrement the runtime PM usage counter of @dev and if it turns out to be
* equal to 0, queue up a work item for @dev like in pm_request_autosuspend().
- *
- * Return:
- * * %1: Success. Usage counter dropped to zero, but device was already suspended.
- * * %0: Success.
- * * %-EINVAL: Runtime PM error.
- * * %-EACCES: Runtime PM disabled.
- * * %-EAGAIN: Runtime PM usage counter became 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_runtime_put_autosuspend(struct device *dev)
+static inline void __pm_runtime_put_autosuspend(struct device *dev)
{
- return __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_ASYNC | RPM_AUTO);
+ __pm_runtime_suspend(dev, RPM_GET_PUT | RPM_ASYNC | RPM_AUTO);
}
/**
@@ -619,23 +607,11 @@ static inline int __pm_runtime_put_autosuspend(struct device *dev)
* Update the last access time of @dev and decrement its runtime PM usage
* counter. If the counter drops to zero, asynchronously request the PM core to
* suspend the device once its autosuspend delay has elapsed.
- *
- * Return:
- * * %1: Success. Usage counter dropped to zero, but device was already suspended.
- * * %0: Success.
- * * %-EINVAL: Runtime PM error.
- * * %-EACCES: Runtime PM disabled.
- * * %-EAGAIN: Runtime PM usage counter became 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_runtime_put_autosuspend(struct device *dev)
+static inline void pm_runtime_put_autosuspend(struct device *dev)
{
pm_runtime_mark_last_busy(dev);
- return __pm_runtime_put_autosuspend(dev);
+ __pm_runtime_put_autosuspend(dev);
}
DEFINE_GUARD(pm_runtime_noresume, struct device *,
--
2.56.0.360.g66cac248cb-goog