Commit d5df4e65 authored by Patrick Mochel's avatar Patrick Mochel

[power mgmt] Make system state enums match device state values.

Changes the PM_SUSPEND_MEM (and PM_SUSPEND_DISK) enum values so that
they make sense as PCI device power states.

(a) Fixes bugs whereby PCI drivers are being given bogus values.
    This should resolve OSDL bugid 2886 without changing the PCI
    API (its PM calls still act as on 2.4 kernels).

(b) Doesn't change the awkward assumption in the 2.6 PMcore that
    the /sys/bus/*/devices/power/state, /proc/acpi/sleep,
    dev->power.power_state, and dev->detach_state files share
    the same numeric codes ... even for busses very unlike PCI,
    or systems with several "on" policies as well as STD and STR,
    or with device-PM transtions with no system-wide equivalent.

Really we need to move away from "u32" codes that are easily confused
with each other, towards typed values (probably struct pointers), but
that's a long-term change and we need the PCI issue fixed sooner.
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
parent 69d7d593
......@@ -194,11 +194,12 @@ extern void (*pm_idle)(void);
extern void (*pm_power_off)(void);
enum {
PM_SUSPEND_ON,
PM_SUSPEND_STANDBY,
PM_SUSPEND_MEM,
PM_SUSPEND_DISK,
PM_SUSPEND_MAX,
PM_SUSPEND_ON = 0,
PM_SUSPEND_STANDBY = 1,
/* NOTE: PM_SUSPEND_MEM == PCI_D3hot */
PM_SUSPEND_MEM = 3,
PM_SUSPEND_DISK = 4,
PM_SUSPEND_MAX = 5,
};
enum {
......
......@@ -230,8 +230,8 @@ static ssize_t state_store(struct subsystem * subsys, const char * buf, size_t n
p = memchr(buf, '\n', n);
len = p ? p - buf : n;
for (s = &pm_states[state]; *s; s++, state++) {
if (!strncmp(buf, *s, len))
for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
if (*s && !strncmp(buf, *s, len))
break;
}
if (*s)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment