diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-06-20 18:19:33 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-07-01 07:31:23 -0400 |
commit | b2df1d4f8b95d9d1e3f064cef02fc5c5116b05cf (patch) | |
tree | 6e891ad6ad748ea737ab5774983f90d9be720446 /kernel/power | |
parent | 4b7760ba0dd3319f66886ab2335a0fbecdbc808a (diff) |
PM / Sleep: Separate printing suspend times from initcall_debug
Change the behavior of the newly introduced
/sys/power/pm_print_times attribute so that its initial value
depends on initcall_debug, but setting it to 0 will cause device
suspend/resume times not to be printed, even if initcall_debug has
been set. This way, the people who use initcall_debug for reasons
other than PM debugging will be able to switch the suspend/resume
times printing off, if need be.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/Kconfig | 4 | ||||
-rw-r--r-- | kernel/power/main.c | 76 |
2 files changed, 46 insertions, 34 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 8f9b4eb974e0..a70518c9d82f 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -175,7 +175,7 @@ config PM_TEST_SUSPEND | |||
175 | You probably want to have your system's RTC driver statically | 175 | You probably want to have your system's RTC driver statically |
176 | linked, ensuring that it's available when this test runs. | 176 | linked, ensuring that it's available when this test runs. |
177 | 177 | ||
178 | config CAN_PM_TRACE | 178 | config PM_SLEEP_DEBUG |
179 | def_bool y | 179 | def_bool y |
180 | depends on PM_DEBUG && PM_SLEEP | 180 | depends on PM_DEBUG && PM_SLEEP |
181 | 181 | ||
@@ -196,7 +196,7 @@ config PM_TRACE | |||
196 | 196 | ||
197 | config PM_TRACE_RTC | 197 | config PM_TRACE_RTC |
198 | bool "Suspend/resume event tracing" | 198 | bool "Suspend/resume event tracing" |
199 | depends on CAN_PM_TRACE | 199 | depends on PM_SLEEP_DEBUG |
200 | depends on X86 | 200 | depends on X86 |
201 | select PM_TRACE | 201 | select PM_TRACE |
202 | ---help--- | 202 | ---help--- |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 7beb3fb3670b..f458238109cc 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -132,38 +132,6 @@ static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr, | |||
132 | } | 132 | } |
133 | 133 | ||
134 | power_attr(pm_test); | 134 | power_attr(pm_test); |
135 | |||
136 | /* | ||
137 | * pm_print_times: print time taken by devices to suspend and resume. | ||
138 | * | ||
139 | * show() returns whether printing of suspend and resume times is enabled. | ||
140 | * store() accepts 0 or 1. 0 disables printing and 1 enables it. | ||
141 | */ | ||
142 | int pm_print_times_enabled; | ||
143 | |||
144 | static ssize_t pm_print_times_show(struct kobject *kobj, | ||
145 | struct kobj_attribute *attr, char *buf) | ||
146 | { | ||
147 | return sprintf(buf, "%d\n", pm_print_times_enabled); | ||
148 | } | ||
149 | |||
150 | static ssize_t pm_print_times_store(struct kobject *kobj, | ||
151 | struct kobj_attribute *attr, | ||
152 | const char *buf, size_t n) | ||
153 | { | ||
154 | unsigned long val; | ||
155 | |||
156 | if (kstrtoul(buf, 10, &val)) | ||
157 | return -EINVAL; | ||
158 | |||
159 | if (val > 1) | ||
160 | return -EINVAL; | ||
161 | |||
162 | pm_print_times_enabled = val; | ||
163 | return n; | ||
164 | } | ||
165 | |||
166 | power_attr(pm_print_times); | ||
167 | #endif /* CONFIG_PM_DEBUG */ | 135 | #endif /* CONFIG_PM_DEBUG */ |
168 | 136 | ||
169 | #ifdef CONFIG_DEBUG_FS | 137 | #ifdef CONFIG_DEBUG_FS |
@@ -267,6 +235,47 @@ late_initcall(pm_debugfs_init); | |||
267 | 235 | ||
268 | #endif /* CONFIG_PM_SLEEP */ | 236 | #endif /* CONFIG_PM_SLEEP */ |
269 | 237 | ||
238 | #ifdef CONFIG_PM_SLEEP_DEBUG | ||
239 | /* | ||
240 | * pm_print_times: print time taken by devices to suspend and resume. | ||
241 | * | ||
242 | * show() returns whether printing of suspend and resume times is enabled. | ||
243 | * store() accepts 0 or 1. 0 disables printing and 1 enables it. | ||
244 | */ | ||
245 | bool pm_print_times_enabled; | ||
246 | |||
247 | static ssize_t pm_print_times_show(struct kobject *kobj, | ||
248 | struct kobj_attribute *attr, char *buf) | ||
249 | { | ||
250 | return sprintf(buf, "%d\n", pm_print_times_enabled); | ||
251 | } | ||
252 | |||
253 | static ssize_t pm_print_times_store(struct kobject *kobj, | ||
254 | struct kobj_attribute *attr, | ||
255 | const char *buf, size_t n) | ||
256 | { | ||
257 | unsigned long val; | ||
258 | |||
259 | if (kstrtoul(buf, 10, &val)) | ||
260 | return -EINVAL; | ||
261 | |||
262 | if (val > 1) | ||
263 | return -EINVAL; | ||
264 | |||
265 | pm_print_times_enabled = !!val; | ||
266 | return n; | ||
267 | } | ||
268 | |||
269 | power_attr(pm_print_times); | ||
270 | |||
271 | static inline void pm_print_times_init(void) | ||
272 | { | ||
273 | pm_print_times_enabled = !!initcall_debug; | ||
274 | } | ||
275 | #else /* !CONFIG_PP_SLEEP_DEBUG */ | ||
276 | static inline void pm_print_times_init(void) {} | ||
277 | #endif /* CONFIG_PM_SLEEP_DEBUG */ | ||
278 | |||
270 | struct kobject *power_kobj; | 279 | struct kobject *power_kobj; |
271 | 280 | ||
272 | /** | 281 | /** |
@@ -562,6 +571,8 @@ static struct attribute * g[] = { | |||
562 | #endif | 571 | #endif |
563 | #ifdef CONFIG_PM_DEBUG | 572 | #ifdef CONFIG_PM_DEBUG |
564 | &pm_test_attr.attr, | 573 | &pm_test_attr.attr, |
574 | #endif | ||
575 | #ifdef CONFIG_PM_SLEEP_DEBUG | ||
565 | &pm_print_times_attr.attr, | 576 | &pm_print_times_attr.attr, |
566 | #endif | 577 | #endif |
567 | #endif | 578 | #endif |
@@ -599,6 +610,7 @@ static int __init pm_init(void) | |||
599 | error = sysfs_create_group(power_kobj, &attr_group); | 610 | error = sysfs_create_group(power_kobj, &attr_group); |
600 | if (error) | 611 | if (error) |
601 | return error; | 612 | return error; |
613 | pm_print_times_init(); | ||
602 | return pm_autosleep_init(); | 614 | return pm_autosleep_init(); |
603 | } | 615 | } |
604 | 616 | ||