Skip to content

Commit 2bca293

Browse files
David Brownellgregkh
authored andcommitted
PM: add kconfig option for deprecated .../power/state files
Add a new PM_SYSFS_DEPRECATED config option to control whether or not the /sys/devices/.../power/state files are provided. This will make it easier to get rid of that mechanism when the time comes, and to verify that userspace tools work right without it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Acked-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 047bda3 commit 2bca293

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎drivers/base/power/sysfs.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include "power.h"
88

99

10+
#ifdef CONFIG_PM_SYSFS_DEPRECATED
11+
1012
/**
1113
* state - Control current power state of device
1214
*
@@ -66,6 +68,8 @@ static ssize_t state_store(struct device * dev, struct device_attribute *attr, c
6668
static DEVICE_ATTR(state, 0644, state_show, state_store);
6769

6870

71+
#endif /* CONFIG_PM_SYSFS_DEPRECATED */
72+
6973
/*
7074
* wakeup - Report/change current wakeup option for device
7175
*
@@ -139,7 +143,9 @@ static DEVICE_ATTR(wakeup, 0644, wake_show, wake_store);
139143

140144

141145
static struct attribute * power_attrs[] = {
146+
#ifdef CONFIG_PM_SYSFS_DEPRECATED
142147
&dev_attr_state.attr,
148+
#endif
143149
&dev_attr_wakeup.attr,
144150
NULL,
145151
};

‎kernel/power/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ config PM_TRACE
5353
CAUTION: this option will cause your machine's real-time clock to be
5454
set to an invalid time after a resume.
5555

56+
config PM_SYSFS_DEPRECATED
57+
bool "Driver model /sys/devices/.../power/state files (DEPRECATED)"
58+
depends on PM && SYSFS
59+
default n
60+
help
61+
The driver model started out with a sysfs file intended to provide
62+
a userspace hook for device power management. This feature has never
63+
worked very well, except for limited testing purposes, and so it will
64+
be removed. It's not clear that a generic mechanism could really
65+
handle the wide variability of device power states; any replacements
66+
are likely to be bus or driver specific.
5667

5768
config SOFTWARE_SUSPEND
5869
bool "Software Suspend"

0 commit comments

Comments
 (0)