PM: runtime: Eliminate __pm_runtime_put_autosuspend()
Subsystems (5)
Rafael J. Wysocki
maintainerPATCH 1/1 PM: runtime: Eliminate __pm_runtime_put_autosuspend()
From: "Rafael J. Wysocki" <[email protected]>
There are two users of __pm_runtime_put_autosuspend(), pm_runtime_put_autosuspend() and arm_smmu_rpm_put(), but the latter duplicates the code from the former.
Fold __pm_runtime_put_autosuspend() into pm_runtime_put_autosuspend() and make arm_smmu_rpm_put() call the latter.
No intentional functional impact.
--- Documentation/power/runtime_pm.rst | 1 - drivers/iommu/arm/arm-smmu/arm-smmu.c | 7 ++----- include/linux/pm_runtime.h | 26 +------------------------- 3 files changed, 3 insertions(+), 31 deletions(-)
Documentation/power/runtime_pm.rst +0 -1
@@ -338,7 +338,6 @@ It is safe to execute the following help - pm_runtime_put_noidle() - pm_runtime_put() - pm_runtime_put_autosuspend() -- __pm_runtime_put_autosuspend() - pm_runtime_enable() - pm_suspend_ignore_children() - pm_runtime_set_active()
drivers/iommu/arm/arm-smmu/arm-smmu.c +2 -5
@@ -79,11 +79,8 @@ static inline int arm_smmu_rpm_get(strucstatic inline void arm_smmu_rpm_put (struct arm_smmu_device *smmu) { -if (pm_runtime_enabled (smmu->dev)) { -pm_runtime_mark_last_busy (smmu->dev); -__pm_runtime_put_autosuspend (smmu->dev); - - } +if (pm_runtime_enabled (smmu->dev)) +pm_runtime_put_autosuspend (smmu->dev); }static void arm_smmu_rpm_use_autosuspend (struct arm_smmu_device *smmu)
include/linux/pm_runtime.h +1 -25
@@ -588,30 +588,6 @@ static inline void pm_runtime_put(struct }/** -* __pm_runtime_put_autosuspend - Drop device usage counter and queue autosuspend if 0. -* @dev: Target device. -* -* 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) -{ -return __pm_runtime_suspend (dev,RPM_GET_PUT |RPM_ASYNC |RPM_AUTO ); -} - -/** * pm_runtime_put_autosuspend - Update the last access time, drop usage counter * and request autosuspend. * @dev: Target device.
@@ -635,7 +611,7 @@ static inline int __pm_runtime_put_autosstatic inline int pm_runtime_put_autosuspend (struct device *dev) {pm_runtime_mark_last_busy (dev); -return __pm_runtime_put_autosuspend (dev); +return __pm_runtime_suspend (dev,RPM_GET_PUT |RPM_ASYNC |RPM_AUTO ); } DEFINE_GUARD(pm_runtime_noresume, struct device *,
Quoted 5 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
There are two users of
__pm_runtime_put_autosuspend(),pm_runtime_put_autosuspend()andarm_smmu_rpm_put(), but the latter duplicates the code from the former.
Aha, indeed it was only this way to minimise conflicts with Sakari's original refactoring, since that led us to realise that we did actually want the mark_last_busy behaviour here anyway[1]. Evidently it missed anyone's to-do list to come back and clean it up post-merge - thanks for finally sorting it!
Quoted 4 lines
Fold
__pm_runtime_put_autosuspend()intopm_runtime_put_autosuspend()and makearm_smmu_rpm_put()call the latter.No intentional functional impact.
[1] https://lore.kernel.org/all/[email protected]/
Quoted 78 lines
Signed-off-by Rafael J. Wysocki <[email protected]>--- Documentation/power/runtime_pm.rst | 1 - drivers/iommu/arm/arm-smmu/arm-smmu.c | 7 ++----- include/linux/pm_runtime.h | 26 +------------------------- 3 files changed, 3 insertions(+), 31 deletions(-)Documentation/power/runtime_pm.rst +0
-1@@ -338,7 +338,6 @@ It is safe to execute the following help - pm_runtime_put_noidle() - pm_runtime_put() - pm_runtime_put_autosuspend() -- __pm_runtime_put_autosuspend() - pm_runtime_enable() - pm_suspend_ignore_children() - pm_runtime_set_active()drivers/iommu/arm/arm-smmu/arm-smmu.c +2
-5@@ -79,11 +79,8 @@ static inline int arm_smmu_rpm_get(strucstatic inline void arm_smmu_rpm_put (struct arm_smmu_device *smmu) { -if (pm_runtime_enabled (smmu->dev)) { -pm_runtime_mark_last_busy (smmu->dev); -__pm_runtime_put_autosuspend (smmu->dev); - - } +if (pm_runtime_enabled (smmu->dev)) +pm_runtime_put_autosuspend (smmu->dev); }static void arm_smmu_rpm_use_autosuspend (struct arm_smmu_device *smmu)include/linux/pm_runtime.h +1
-25@@ -588,30 +588,6 @@ static inline void pm_runtime_put(struct }/** -* __pm_runtime_put_autosuspend - Drop device usage counter and queue autosuspend if 0. -* @dev: Target device. -* -* 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) -{ -return __pm_runtime_suspend (dev,RPM_GET_PUT |RPM_ASYNC |RPM_AUTO ); -} - -/** * pm_runtime_put_autosuspend - Update the last access time, drop usage counter * and request autosuspend. * @dev: Target device. @@ -635,7 +611,7 @@ static inline int __pm_runtime_put_autosstatic inline int pm_runtime_put_autosuspend (struct device *dev) {pm_runtime_mark_last_busy (dev); -return __pm_runtime_put_autosuspend (dev); +return __pm_runtime_suspend (dev,RPM_GET_PUT |RPM_ASYNC |RPM_AUTO ); } DEFINE_GUARD(pm_runtime_noresume, struct device *,
Quoted 6 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
There are two users of
__pm_runtime_put_autosuspend(),pm_runtime_put_autosuspend()andarm_smmu_rpm_put(), but the latter duplicates the code from the former.
Quoted 6 lines
Fold
__pm_runtime_put_autosuspend()intopm_runtime_put_autosuspend()and makearm_smmu_rpm_put()call the latter.No intentional functional impact.
Signed-off-by Rafael J. Wysocki <[email protected]>
Ah, it's about time. I was thinking Prakash's patches would handle this semi-naturally eventually, but they seem to be stalling.
Hi Rafael,
Quoted 6 lines · Rafael J. Wysocki
From: "Rafael J. Wysocki" <[email protected]>
There are two users of
__pm_runtime_put_autosuspend(),pm_runtime_put_autosuspend()andarm_smmu_rpm_put(), but the latter duplicates the code from the former.
Quoted 6 lines
Fold
__pm_runtime_put_autosuspend()intopm_runtime_put_autosuspend()and makearm_smmu_rpm_put()call the latter.No intentional functional impact.
Signed-off-by Rafael J. Wysocki <[email protected]>
Thanks! This is a nice cleanup.
Signature · 1 line
Sakari Ailus