PM / sleep: invalidate TEST_CPUS and TEST_CORE support for freeze state
authorZhang Rui <rui.zhang@intel.com>
Wed, 27 Mar 2013 03:36:11 +0000 (03:36 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 5 Apr 2013 12:18:25 +0000 (14:18 +0200)
freeze state is a software suspend state that does not run into
low-level platform callbacks which may interact with BIOS.
And freeze state does not need to disable the processors.

But the current pm_test support misleads users because users
can enter freeze state with pm_test set to TEST_CPUS/TEST_CORE,
while this pm_test setting never takes actions.

So, invalidate TEST_CPUS/TEST_CORE for freeze state in this patch.
Then users will get an error instead, when trying to
enter freeze state with pm_test mode set to TEST_CPUS/TEST_CORE.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/suspend.c

index 5eb30aa..bef86d1 100644 (file)
@@ -76,8 +76,20 @@ EXPORT_SYMBOL_GPL(suspend_set_ops);
 
 bool valid_state(suspend_state_t state)
 {
-       if (state == PM_SUSPEND_FREEZE)
-               return true;
+       if (state == PM_SUSPEND_FREEZE) {
+#ifdef CONFIG_PM_DEBUG
+               if (pm_test_level != TEST_NONE &&
+                   pm_test_level != TEST_FREEZER &&
+                   pm_test_level != TEST_DEVICES &&
+                   pm_test_level != TEST_PLATFORM) {
+                       printk(KERN_WARNING "Unsupported pm_test mode for "
+                                       "freeze state, please choose "
+                                       "none/freezer/devices/platform.\n");
+                       return false;
+               }
+#endif
+                       return true;
+       }
        /*
         * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel
         * support and need to be valid to the lowlevel