]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PM: sysfs: Move debug runtime PM attributes to runtime_attrs[]
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 7 May 2025 14:29:37 +0000 (16:29 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 9 May 2025 13:59:27 +0000 (15:59 +0200)
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
drivers/base/power/sysfs.c

index f84018125b466d1d6950692bd3faaf0a56b8a86d..13b31a3adc77c0fe0a5c42fcf9b863dd5bc43088 100644 (file)
@@ -611,15 +611,9 @@ static DEVICE_ATTR_RW(async);
 #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 const struct attribute_group pm_wakeup_attr_group = {
 };
 
 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 = {