Skip to contentSkip to conversation

PM: runtime: Replace pm_runtime_callbacks_present()

PATCH In review Rafael J. Wysocki 2 participants 2 messages May 28, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM: runtime: Replace pm_runtime_callbacks_present()

From: Rafael J. Wysocki <[email protected]>

The name of pm_runtime_callbacks_present() is confusing, because it suggests that the device has PM-runtime callbacks if 'true' is returned by that function, but in fact that may not be the case, so replace it with pm_runtime_has_no_callbacks() which is not ambiguous.

No functional impact.

---
 drivers/base/power/sysfs.c |    4 ++--
 include/linux/pm_runtime.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
include/linux/pm_runtime.h +2 -2
Index: linux-pm/include/linux/pm_runtime.h
===================================================================
@@ -102,9 +102,9 @@ static inline bool pm_runtime_enabled(st
 	return !dev->power.disable_depth;
 }
 
-static inline bool pm_runtime_callbacks_present(struct device *dev)
+static inline bool pm_runtime_has_no_callbacks(struct device *dev)
 {
-	return !dev->power.no_callbacks;
+	return dev->power.no_callbacks;
 }
 
 static inline void pm_runtime_mark_last_busy(struct device *dev)
drivers/base/power/sysfs.c +2 -2
Index: linux-pm/drivers/base/power/sysfs.c
===================================================================
@@ -666,7 +666,7 @@ int dpm_sysfs_add(struct device *dev)
 	if (rc)
 		return rc;
 
-	if (pm_runtime_callbacks_present(dev)) {
+	if (!pm_runtime_has_no_callbacks(dev)) {
 		rc = sysfs_merge_group(&dev->kobj, &pm_runtime_attr_group);
 		if (rc)
 			goto err_out;
@@ -709,7 +709,7 @@ int dpm_sysfs_change_owner(struct device
 	if (rc)
 		return rc;
 
-	if (pm_runtime_callbacks_present(dev)) {
+	if (!pm_runtime_has_no_callbacks(dev)) {
 		rc = sysfs_group_change_owner(
 			&dev->kobj, &pm_runtime_attr_group, kuid, kgid);
 		if (rc)
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

The name of pm_runtime_callbacks_present() is confusing, because it suggests that the device has PM-runtime callbacks if 'true' is returned by that function, but in fact that may not be the case, so replace it with pm_runtime_has_no_callbacks() which is not ambiguous.

Quoted 3 lines

No functional impact.

Makes sense to me, feel free to add:

Kind regards
Uffe

Quoted 46 lines
---
 drivers/base/power/sysfs.c |    4 ++--
 include/linux/pm_runtime.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Index: linux-pm/include/linux/pm_runtime.h
===================================================================

include/linux/pm_runtime.h +2 -2
@@ -102,9 +102,9 @@ static inline bool pm_runtime_enabled(st
        return !dev->power.disable_depth;
 }
 
-static inline bool pm_runtime_callbacks_present(struct device *dev)
+static inline bool pm_runtime_has_no_callbacks(struct device *dev)
 {
-       return !dev->power.no_callbacks;
+       return dev->power.no_callbacks;
 }
 
 static inline void pm_runtime_mark_last_busy(struct device *dev)

Index: linux-pm/drivers/base/power/sysfs.c
===================================================================

drivers/base/power/sysfs.c +2 -2
@@ -666,7 +666,7 @@ int dpm_sysfs_add(struct device *dev)
        if (rc)
                return rc;
 
-       if (pm_runtime_callbacks_present(dev)) {
+       if (!pm_runtime_has_no_callbacks(dev)) {
                rc = sysfs_merge_group(&dev->kobj, &pm_runtime_attr_group);
                if (rc)
                        goto err_out;
@@ -709,7 +709,7 @@ int dpm_sysfs_change_owner(struct device
        if (rc)
                return rc;
 
-       if (pm_runtime_callbacks_present(dev)) {
+       if (!pm_runtime_has_no_callbacks(dev)) {
                rc = sysfs_group_change_owner(
                        &dev->kobj, &pm_runtime_attr_group, kuid, kgid);
                if (rc)