PM / sysfs: Expose suspend resume driver flags in sysfs
Subsystems (4)
PATCH 1/1 PM / sysfs: Expose suspend resume driver flags in sysfs
Currently there are 4 driver flags to control system suspend/resume
behavior: DPM_FLAG_NO_DIRECT_COMPLETE, DPM_FLAG_SMART_PREPARE, DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME. Make these flags visible in sysfs as read-only to get a brief understanding of the expected behavior of each device during suspend/resume, so as to facilitate suspend/resume debugging/tuning.
For example:
/sys/devices/pci0000:00/0000:00:15.1/power/driver_flags:4 (DPM_FLAG_SMART_SUSPEND)
/sys/devices/pci0000:00/0000:00:07.3/power/driver_flags:5 (DPM_FLAG_NO_DIRECT_COMPLETE | DPM_FLAG_SMART_SUSPEND)
--- drivers/base/power/sysfs.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/base/power/sysfs.c +28 -1
@@ -607,6 +607,13 @@ static ssize_t async_store(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RW (async); +static ssize_t driver_flags_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sysfs_emit (buf,"%x\n" , dev->power.driver_flags); +} +static DEVICE_ATTR_RO (driver_flags); +#endif /* CONFIG_PM_SLEEP */ #endif /* CONFIG_PM_ADVANCED_DEBUG */
@@ -691,6 +698,20 @@ static const struct attribute_group pm_qos_flags_attr_group = { .attrs = pm_qos_flags_attrs, }; +static struct attribute *pm_driver_flags_attrs[] = { +#ifdef CONFIG_PM_ADVANCED_DEBUG +#ifdef CONFIG_PM_SLEEP + &dev_attr_driver_flags.attr, +#endif +#endif + NULL, +}; + +static const struct attribute_group pm_driver_flags_attr_group = { + .name = power_group_name, + .attrs = pm_driver_flags_attrs, +}; +int dpm_sysfs_add (struct device *dev) {int rc;
@@ -719,11 +740,17 @@ int dpm_sysfs_add(struct device *dev)if (rc) goto err_wakeup; } - rc =pm_wakeup_source_sysfs_add (dev); + rc =sysfs_merge_group (&dev->kobj, &pm_driver_flags_attr_group);if (rc) goto err_latency; + + rc =pm_wakeup_source_sysfs_add (dev); +if (rc) + goto err_flags;return 0 ; + err_flags: +sysfs_unmerge_group (&dev->kobj, &pm_driver_flags_attr_group); err_latency:sysfs_unmerge_group (&dev->kobj, &pm_qos_latency_tolerance_attr_group); err_wakeup:
Signature · 1 line
2.17.1
Greg Kroah-Hartman
maintainerQuoted 11 lines · Chen Yu
Currently there are 4 driver flags to control system suspend/resume
behavior:DPM_FLAG_NO_DIRECT_COMPLETE,DPM_FLAG_SMART_PREPARE,DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUME. Make these flags visible in sysfs as read-only to get a brief understanding of the expected behavior of each device during suspend/resume, so as to facilitate suspend/resume debugging/tuning.For example:
/sys/devices/pci0000:00/0000:00:15.1/power/driver_flags:4 (DPM_FLAG_SMART_SUSPEND)
Quoted 8 lines
/sys/devices/pci0000:00/0000:00:07.3/power/driver_flags:5 (
DPM_FLAG_NO_DIRECT_COMPLETE|DPM_FLAG_SMART_SUSPEND)Acked-by Len Brown <[email protected]>Signed-off-by Chen Yu <[email protected]>--- drivers/base/power/sysfs.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
There is no Documentataion/ABI/ entry for your new file, which makes this patch impossible to properly review by anyone, and prevents it from being able to be accepted.
Please fix.
thanks,
greg k-h
Hi Greg,
thanks for taking a look at this.
Quoted 21 lines · Greg Kroah-Hartman
Quoted 11 lines · Chen Yu
Currently there are 4 driver flags to control system suspend/resume
behavior:DPM_FLAG_NO_DIRECT_COMPLETE,DPM_FLAG_SMART_PREPARE,DPM_FLAG_SMART_SUSPENDandDPM_FLAG_MAY_SKIP_RESUME. Make these flags visible in sysfs as read-only to get a brief understanding of the expected behavior of each device during suspend/resume, so as to facilitate suspend/resume debugging/tuning.For example:
/sys/devices/pci0000:00/0000:00:15.1/power/driver_flags:4 (DPM_FLAG_SMART_SUSPEND)Quoted 8 lines
/sys/devices/pci0000:00/0000:00:07.3/power/driver_flags:5 (
DPM_FLAG_NO_DIRECT_COMPLETE|DPM_FLAG_SMART_SUSPEND)Acked-by Len Brown <[email protected]>Signed-off-by Chen Yu <[email protected]>--- drivers/base/power/sysfs.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
Quoted 6 lines
There is no Documentataion/ABI/ entry for your new file, which makes this patch impossible to properly review by anyone, and prevents it from being able to be accepted.
Please fix.
Okay, will add the entry in the document.
thanks,
Chenyu
Quoted 3 lines
thanks,
greg k-h