All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM: runtime: Replace pm_runtime_callbacks_present()
@ 2020-05-28 14:45 Rafael J. Wysocki
  2020-05-28 22:33 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Rafael J. Wysocki @ 2020-05-28 14:45 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML, Rafael J. Wysocki, Ulf Hansson

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 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
===================================================================
--- linux-pm.orig/include/linux/pm_runtime.h
+++ 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)
Index: linux-pm/drivers/base/power/sysfs.c
===================================================================
--- linux-pm.orig/drivers/base/power/sysfs.c
+++ 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)




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] PM: runtime: Replace pm_runtime_callbacks_present()
  2020-05-28 14:45 [PATCH] PM: runtime: Replace pm_runtime_callbacks_present() Rafael J. Wysocki
@ 2020-05-28 22:33 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2020-05-28 22:33 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux PM, LKML, Rafael J. Wysocki

On Thu, 28 May 2020 at 16:45, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Makes sense to me, feel free to add:

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  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
> ===================================================================
> --- linux-pm.orig/include/linux/pm_runtime.h
> +++ 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)
> Index: linux-pm/drivers/base/power/sysfs.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/sysfs.c
> +++ 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)
>
>
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-28 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 14:45 [PATCH] PM: runtime: Replace pm_runtime_callbacks_present() Rafael J. Wysocki
2020-05-28 22:33 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.