mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
power management: implement pm_ops.valid for everybody
Almost all users of pm_ops only support mem sleep, don't check in .valid and don't reject any others in .prepare so users can be confused if they check /sys/power/state, especially when new states are added (these would then result in s-t-r although they're supposed to be something different). This patch implements a generic pm_valid_only_mem function that is then exported for users and puts it to use in almost all existing pm_ops. Signed-off-by: Johannes Berg <[email protected]> Cc: David Brownell <[email protected]> Acked-by: Pavel Machek <[email protected]> Cc: [email protected] Cc: Len Brown <[email protected]> Acked-by: Russell King <[email protected]> Cc: Greg KH <[email protected]> Cc: "Rafael J. Wysocki" <[email protected]> Cc: Paul Mundt <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
11d77d0c01
commit
e8c9c50269
11 changed files with 39 additions and 55 deletions
|
|
@ -168,9 +168,18 @@ int acpi_suspend(u32 acpi_state)
|
|||
|
||||
static int acpi_pm_state_valid(suspend_state_t pm_state)
|
||||
{
|
||||
u32 acpi_state = acpi_suspend_states[pm_state];
|
||||
u32 acpi_state;
|
||||
|
||||
return sleep_states[acpi_state];
|
||||
switch (pm_state) {
|
||||
case PM_SUSPEND_ON:
|
||||
case PM_SUSPEND_STANDBY:
|
||||
case PM_SUSPEND_MEM:
|
||||
acpi_state = acpi_suspend_states[pm_state];
|
||||
|
||||
return sleep_states[acpi_state];
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static struct pm_ops acpi_pm_ops = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue