linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 2/2] PM: invalidate TEST_CPUS and TEST_CORE support for freeze state
@ 2013-03-12  1:21 Zhang Rui
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang Rui @ 2013-03-12  1:21 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux PM list, Kristen Carlson Accardi

>From 0777c83233875e2f84c21f76145058f513894abd Mon Sep 17 00:00:00 2001
From: Zhang Rui <rui.zhang@intel.com>
Date: Wed, 6 Mar 2013 21:22:21 +0800
Subject: [PATCH RESEND 2/2] PM: invalidate TEST_CPUS and TEST_CORE support for
 freeze state

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>
---
 kernel/power/suspend.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 5eb30aa..e29909a 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -76,8 +76,16 @@ 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) {
+		if (pm_test_level == TEST_NONE ||
+		    pm_test_level == TEST_FREEZER ||
+		    pm_test_level == TEST_DEVICES ||
+		    pm_test_level == TEST_PLATFORM)
+			return true;
+		printk(KERN_WARNING "Unsupported pm_test mode for freeze state,"
+			" please choose none/freezer/devices/platform.\n");
+		return false;
+	}
 	/*
 	 * PM_SUSPEND_STANDBY and PM_SUSPEND_MEMORY states need lowlevel
 	 * support and need to be valid to the lowlevel
-- 
1.7.9.5




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH RESEND 2/2] PM: invalidate TEST_CPUS and TEST_CORE support for freeze state
  2013-03-27  3:36 [PATCH RESEND 1/2] PM: add TEST_PLATFORM " Zhang Rui
@ 2013-03-27  3:36 ` Zhang Rui
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang Rui @ 2013-03-27  3:36 UTC (permalink / raw)
  To: rjw; +Cc: linux-pm, Zhang Rui

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>
---
 kernel/power/suspend.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 5eb30aa..bef86d1 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -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
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-27  3:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12  1:21 [PATCH RESEND 2/2] PM: invalidate TEST_CPUS and TEST_CORE support for freeze state Zhang Rui
  -- strict thread matches above, loose matches on Subject: below --
2013-03-27  3:36 [PATCH RESEND 1/2] PM: add TEST_PLATFORM " Zhang Rui
2013-03-27  3:36 ` [PATCH RESEND 2/2] PM: invalidate TEST_CPUS and TEST_CORE " Zhang Rui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).