* [PATCH v1] PM: sysfs: Move debug runtime PM attributes to runtime_attrs[]
@ 2025-05-07 14:29 Rafael J. Wysocki
2025-05-07 14:50 ` Sudeep Holla
2025-05-07 15:38 ` Ulf Hansson
0 siblings, 2 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2025-05-07 14:29 UTC (permalink / raw)
To: Linux PM; +Cc: LKML, Ulf Hansson, Sudeep Holla
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Some of the debug sysfs attributes for runtime PM are located
in the power_attrs[] table, so they are exposed even in the
pm_runtime_has_no_callbacks() case, unlike the other non-debug
sysfs attributes for runtime PM, which may be confusing.
Moreover, dev_attr_runtime_status.attr appears in two
places, which effectively causes it to be always exposed if
CONFIG_PM_ADVANCED_DEBUG is set, but otherwise it is exposed
only when pm_runtime_has_no_callbacks() returns 'false'.
Address this by putting all sysfs attributes for runtime PM into
runtime_attrs[].
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/base/power/sysfs.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -611,15 +611,9 @@
#endif /* CONFIG_PM_ADVANCED_DEBUG */
static struct attribute *power_attrs[] = {
-#ifdef CONFIG_PM_ADVANCED_DEBUG
-#ifdef CONFIG_PM_SLEEP
+#if defined(CONFIG_PM_ADVANCED_DEBUG) && defined(CONFIG_PM_SLEEP)
&dev_attr_async.attr,
#endif
- &dev_attr_runtime_status.attr,
- &dev_attr_runtime_usage.attr,
- &dev_attr_runtime_active_kids.attr,
- &dev_attr_runtime_enabled.attr,
-#endif /* CONFIG_PM_ADVANCED_DEBUG */
NULL,
};
static const struct attribute_group pm_attr_group = {
@@ -650,13 +644,16 @@
};
static struct attribute *runtime_attrs[] = {
-#ifndef CONFIG_PM_ADVANCED_DEBUG
&dev_attr_runtime_status.attr,
-#endif
&dev_attr_control.attr,
&dev_attr_runtime_suspended_time.attr,
&dev_attr_runtime_active_time.attr,
&dev_attr_autosuspend_delay_ms.attr,
+#ifdef CONFIG_PM_ADVANCED_DEBUG
+ &dev_attr_runtime_usage.attr,
+ &dev_attr_runtime_active_kids.attr,
+ &dev_attr_runtime_enabled.attr,
+#endif
NULL,
};
static const struct attribute_group pm_runtime_attr_group = {
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1] PM: sysfs: Move debug runtime PM attributes to runtime_attrs[]
2025-05-07 14:29 [PATCH v1] PM: sysfs: Move debug runtime PM attributes to runtime_attrs[] Rafael J. Wysocki
@ 2025-05-07 14:50 ` Sudeep Holla
2025-05-07 15:38 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2025-05-07 14:50 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM, Sudeep Holla, LKML, Ulf Hansson
On Wed, May 07, 2025 at 04:29:37PM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Some of the debug sysfs attributes for runtime PM are located
> in the power_attrs[] table, so they are exposed even in the
> pm_runtime_has_no_callbacks() case, unlike the other non-debug
> sysfs attributes for runtime PM, which may be confusing.
>
> Moreover, dev_attr_runtime_status.attr appears in two
> places, which effectively causes it to be always exposed if
> CONFIG_PM_ADVANCED_DEBUG is set, but otherwise it is exposed
> only when pm_runtime_has_no_callbacks() returns 'false'.
>
> Address this by putting all sysfs attributes for runtime PM into
> runtime_attrs[].
>
For once I thought it will change the paths before looking at the code
and realising that all the attributes get merged under "../power/".
FWIW:
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] PM: sysfs: Move debug runtime PM attributes to runtime_attrs[]
2025-05-07 14:29 [PATCH v1] PM: sysfs: Move debug runtime PM attributes to runtime_attrs[] Rafael J. Wysocki
2025-05-07 14:50 ` Sudeep Holla
@ 2025-05-07 15:38 ` Ulf Hansson
1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2025-05-07 15:38 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Linux PM, LKML, Sudeep Holla
On Wed, 7 May 2025 at 16:29, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> Some of the debug sysfs attributes for runtime PM are located
> in the power_attrs[] table, so they are exposed even in the
> pm_runtime_has_no_callbacks() case, unlike the other non-debug
> sysfs attributes for runtime PM, which may be confusing.
>
> Moreover, dev_attr_runtime_status.attr appears in two
> places, which effectively causes it to be always exposed if
> CONFIG_PM_ADVANCED_DEBUG is set, but otherwise it is exposed
> only when pm_runtime_has_no_callbacks() returns 'false'.
>
> Address this by putting all sysfs attributes for runtime PM into
> runtime_attrs[].
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Kind regards
Uffe
> ---
> drivers/base/power/sysfs.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> --- a/drivers/base/power/sysfs.c
> +++ b/drivers/base/power/sysfs.c
> @@ -611,15 +611,9 @@
> #endif /* CONFIG_PM_ADVANCED_DEBUG */
>
> static struct attribute *power_attrs[] = {
> -#ifdef CONFIG_PM_ADVANCED_DEBUG
> -#ifdef CONFIG_PM_SLEEP
> +#if defined(CONFIG_PM_ADVANCED_DEBUG) && defined(CONFIG_PM_SLEEP)
> &dev_attr_async.attr,
> #endif
> - &dev_attr_runtime_status.attr,
> - &dev_attr_runtime_usage.attr,
> - &dev_attr_runtime_active_kids.attr,
> - &dev_attr_runtime_enabled.attr,
> -#endif /* CONFIG_PM_ADVANCED_DEBUG */
> NULL,
> };
> static const struct attribute_group pm_attr_group = {
> @@ -650,13 +644,16 @@
> };
>
> static struct attribute *runtime_attrs[] = {
> -#ifndef CONFIG_PM_ADVANCED_DEBUG
> &dev_attr_runtime_status.attr,
> -#endif
> &dev_attr_control.attr,
> &dev_attr_runtime_suspended_time.attr,
> &dev_attr_runtime_active_time.attr,
> &dev_attr_autosuspend_delay_ms.attr,
> +#ifdef CONFIG_PM_ADVANCED_DEBUG
> + &dev_attr_runtime_usage.attr,
> + &dev_attr_runtime_active_kids.attr,
> + &dev_attr_runtime_enabled.attr,
> +#endif
> NULL,
> };
> static const struct attribute_group pm_runtime_attr_group = {
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-05-07 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-07 14:29 [PATCH v1] PM: sysfs: Move debug runtime PM attributes to runtime_attrs[] Rafael J. Wysocki
2025-05-07 14:50 ` Sudeep Holla
2025-05-07 15:38 ` Ulf Hansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox