Skip to content

Commit 495e7a6

Browse files
committed
PM: sysfs: Move debug runtime PM attributes to runtime_attrs[]
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: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://patch.msgid.link/12677254.O9o76ZdvQC@rjwysocki.net
1 parent 73db799 commit 495e7a6

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/base/power/sysfs.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -611,15 +611,9 @@ static DEVICE_ATTR_RW(async);
611611
#endif /* CONFIG_PM_ADVANCED_DEBUG */
612612

613613
static struct attribute *power_attrs[] = {
614-
#ifdef CONFIG_PM_ADVANCED_DEBUG
615-
#ifdef CONFIG_PM_SLEEP
614+
#if defined(CONFIG_PM_ADVANCED_DEBUG) && defined(CONFIG_PM_SLEEP)
616615
&dev_attr_async.attr,
617616
#endif
618-
&dev_attr_runtime_status.attr,
619-
&dev_attr_runtime_usage.attr,
620-
&dev_attr_runtime_active_kids.attr,
621-
&dev_attr_runtime_enabled.attr,
622-
#endif /* CONFIG_PM_ADVANCED_DEBUG */
623617
NULL,
624618
};
625619
static const struct attribute_group pm_attr_group = {
@@ -650,13 +644,16 @@ static const struct attribute_group pm_wakeup_attr_group = {
650644
};
651645

652646
static struct attribute *runtime_attrs[] = {
653-
#ifndef CONFIG_PM_ADVANCED_DEBUG
654647
&dev_attr_runtime_status.attr,
655-
#endif
656648
&dev_attr_control.attr,
657649
&dev_attr_runtime_suspended_time.attr,
658650
&dev_attr_runtime_active_time.attr,
659651
&dev_attr_autosuspend_delay_ms.attr,
652+
#ifdef CONFIG_PM_ADVANCED_DEBUG
653+
&dev_attr_runtime_usage.attr,
654+
&dev_attr_runtime_active_kids.attr,
655+
&dev_attr_runtime_enabled.attr,
656+
#endif
660657
NULL,
661658
};
662659
static const struct attribute_group pm_runtime_attr_group = {

0 commit comments

Comments
 (0)