diff options
author | 2025-02-27 11:47:33 +0100 | |
---|---|---|
committer | 2025-03-03 14:35:07 +0100 | |
commit | 1476bb20eec33bd68b67c7bb7a5d62063af8148d (patch) | |
tree | 298c5de61bae671f0d922d864c598f6e1a0f61d6 /include/linux/pm_runtime.h | |
parent | PM: sleep: Update power.smart_suspend under PM spinlock (diff) | |
download | wireguard-linux-1476bb20eec33bd68b67c7bb7a5d62063af8148d.tar.xz wireguard-linux-1476bb20eec33bd68b67c7bb7a5d62063af8148d.zip |
PM: runtime: Convert pm_runtime_blocked() to static inline
The comment in pm_runtime_blocked() is acutally wrong: power.last_status
is not a bit field. Its data type is an enum and so one can reasonably
assume that partial updates of it will not be observed.
Accordingly, pm_runtime_blocked() can be converted to a static inline
function and the related locking overhead can be eliminated, so long
as it is only used in system suspend/resume code paths because
power.last_status is not expected to be updated concurrently while
that code is running.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/1923449.tdWV9SEqCh@rjwysocki.net
Diffstat (limited to 'include/linux/pm_runtime.h')
-rw-r--r-- | include/linux/pm_runtime.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 4c5b74b745d5..7fb5a459847e 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -82,7 +82,6 @@ extern bool pm_runtime_block_if_disabled(struct device *dev); extern void pm_runtime_unblock(struct device *dev); extern void pm_runtime_enable(struct device *dev); extern void __pm_runtime_disable(struct device *dev, bool check_resume); -extern bool pm_runtime_blocked(struct device *dev); extern void pm_runtime_allow(struct device *dev); extern void pm_runtime_forbid(struct device *dev); extern void pm_runtime_no_callbacks(struct device *dev); @@ -201,6 +200,17 @@ static inline bool pm_runtime_enabled(struct device *dev) } /** + * pm_runtime_blocked - Check if runtime PM enabling is blocked. + * @dev: Target device. + * + * Do not call this function outside system suspend/resume code paths. + */ +static inline bool pm_runtime_blocked(struct device *dev) +{ + return dev->power.last_status == RPM_BLOCKED; +} + +/** * pm_runtime_has_no_callbacks - Check if runtime PM callbacks may be present. * @dev: Target device. * |