PM / sleep: Use valid_state() for platform-dependent sleep states only
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 26 May 2014 11:40:53 +0000 (13:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 5 Oct 2014 21:52:24 +0000 (14:52 -0700)
commit80a5285d665d690dfc29caf496a6b90d5d34e716
tree1cad0c25ad5f4fdf63cfdbd96d2c63eed968b4d9
parent31a52a9e9d71afc65afb9c54479052b1663a5532
PM / sleep: Use valid_state() for platform-dependent sleep states only

commit 43e8317b0bba1d6eb85f38a4a233d82d7c20d732 upstream.

Use the observation that, for platform-dependent sleep states
(PM_SUSPEND_STANDBY, PM_SUSPEND_MEM), a given state is either
always supported or always unsupported and store that information
in pm_states[] instead of calling valid_state() every time we
need to check it.

Also do not use valid_state() for PM_SUSPEND_FREEZE, which is always
valid, and move the pm_test_level validity check for PM_SUSPEND_FREEZE
directly into enter_state().

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/power/main.c
kernel/power/power.h
kernel/power/suspend.c
kernel/power/suspend_test.c