[PATCH] swsusp: switch pm_message_t to struct

This adds type-checking to pm_message_t, so that people can't confuse it
with int or u32.  It also allows us to fix "disk yoyo" during suspend (disk
spinning down/up/down).

[We've tried that before; since that cpufreq problems were fixed and I've
tried make allyes config and fixed resulting damage.]

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Alexander Nyberg <alexn@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Pavel Machek
2005-09-03 15:56:57 -07:00
committed by Linus Torvalds
parent 829ca9a30a
commit ca078bae81
28 changed files with 108 additions and 101 deletions

View File

@@ -26,19 +26,19 @@
static ssize_t state_show(struct device * dev, struct device_attribute *attr, char * buf)
{
return sprintf(buf, "%u\n", dev->power.power_state);
return sprintf(buf, "%u\n", dev->power.power_state.event);
}
static ssize_t state_store(struct device * dev, struct device_attribute *attr, const char * buf, size_t n)
{
u32 state;
pm_message_t state;
char * rest;
int error = 0;
state = simple_strtoul(buf, &rest, 10);
state.event = simple_strtoul(buf, &rest, 10);
if (*rest)
return -EINVAL;
if (state)
if (state.event)
error = dpm_runtime_suspend(dev, state);
else
dpm_runtime_resume(dev);