aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-05-07 23:37:51 -0400
committerPaul Mackerras <paulus@samba.org>2007-05-07 23:37:51 -0400
commit02bbc0f09c90cefdb2837605c96a66c5ce4ba2e1 (patch)
tree04ef573cd4de095c500c9fc3477f4278c0b36300 /kernel/power/main.c
parent7487a2245b8841c77ba9db406cf99a483b9334e9 (diff)
parent5b94f675f57e4ff16c8fda09088d7480a84dcd91 (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 72419a3b1beb..f6dda685e7e2 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -184,17 +184,21 @@ static void suspend_finish(suspend_state_t state)
184static const char * const pm_states[PM_SUSPEND_MAX] = { 184static const char * const pm_states[PM_SUSPEND_MAX] = {
185 [PM_SUSPEND_STANDBY] = "standby", 185 [PM_SUSPEND_STANDBY] = "standby",
186 [PM_SUSPEND_MEM] = "mem", 186 [PM_SUSPEND_MEM] = "mem",
187#ifdef CONFIG_SOFTWARE_SUSPEND
188 [PM_SUSPEND_DISK] = "disk", 187 [PM_SUSPEND_DISK] = "disk",
189#endif
190}; 188};
191 189
192static inline int valid_state(suspend_state_t state) 190static inline int valid_state(suspend_state_t state)
193{ 191{
194 /* Suspend-to-disk does not really need low-level support. 192 /* Suspend-to-disk does not really need low-level support.
195 * It can work with reboot if needed. */ 193 * It can work with shutdown/reboot if needed. If it isn't
194 * configured, then it cannot be supported.
195 */
196 if (state == PM_SUSPEND_DISK) 196 if (state == PM_SUSPEND_DISK)
197#ifdef CONFIG_SOFTWARE_SUSPEND
197 return 1; 198 return 1;
199#else
200 return 0;
201#endif
198 202
199 /* all other states need lowlevel support and need to be 203 /* all other states need lowlevel support and need to be
200 * valid to the lowlevel implementation, no valid callback 204 * valid to the lowlevel implementation, no valid callback
@@ -244,15 +248,6 @@ static int enter_state(suspend_state_t state)
244 return error; 248 return error;
245} 249}
246 250
247/*
248 * This is main interface to the outside world. It needs to be
249 * called from process context.
250 */
251int software_suspend(void)
252{
253 return enter_state(PM_SUSPEND_DISK);
254}
255
256 251
257/** 252/**
258 * pm_suspend - Externally visible function for suspending system. 253 * pm_suspend - Externally visible function for suspending system.
@@ -285,7 +280,7 @@ decl_subsys(power,NULL,NULL);
285 * proper enumerated value, and initiates a suspend transition. 280 * proper enumerated value, and initiates a suspend transition.
286 */ 281 */
287 282
288static ssize_t state_show(struct subsystem * subsys, char * buf) 283static ssize_t state_show(struct kset *kset, char *buf)
289{ 284{
290 int i; 285 int i;
291 char * s = buf; 286 char * s = buf;
@@ -298,7 +293,7 @@ static ssize_t state_show(struct subsystem * subsys, char * buf)
298 return (s - buf); 293 return (s - buf);
299} 294}
300 295
301static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n) 296static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
302{ 297{
303 suspend_state_t state = PM_SUSPEND_STANDBY; 298 suspend_state_t state = PM_SUSPEND_STANDBY;
304 const char * const *s; 299 const char * const *s;
@@ -325,13 +320,13 @@ power_attr(state);
325#ifdef CONFIG_PM_TRACE 320#ifdef CONFIG_PM_TRACE
326int pm_trace_enabled; 321int pm_trace_enabled;
327 322
328static ssize_t pm_trace_show(struct subsystem * subsys, char * buf) 323static ssize_t pm_trace_show(struct kset *kset, char *buf)
329{ 324{
330 return sprintf(buf, "%d\n", pm_trace_enabled); 325 return sprintf(buf, "%d\n", pm_trace_enabled);
331} 326}
332 327
333static ssize_t 328static ssize_t
334pm_trace_store(struct subsystem * subsys, const char * buf, size_t n) 329pm_trace_store(struct kset *kset, const char *buf, size_t n)
335{ 330{
336 int val; 331 int val;
337 332
@@ -365,7 +360,7 @@ static int __init pm_init(void)
365{ 360{
366 int error = subsystem_register(&power_subsys); 361 int error = subsystem_register(&power_subsys);
367 if (!error) 362 if (!error)
368 error = sysfs_create_group(&power_subsys.kset.kobj,&attr_group); 363 error = sysfs_create_group(&power_subsys.kobj,&attr_group);
369 return error; 364 return error;
370} 365}
371 366