Suspend: Add config option to disable the freezer if architecture wants that
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 16 Jan 2008 04:17:00 +0000 (23:17 -0500)
committerLen Brown <len.brown@intel.com>
Fri, 1 Feb 2008 23:30:58 +0000 (18:30 -0500)
This patch makes the freezer optional for suspend to allow the
system to work (or not work) like the original PMU suspend.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
arch/powerpc/Kconfig
kernel/power/Kconfig
kernel/power/main.c
kernel/power/power.h

index 824140d6cd27e9dbe43c01ed0fb84b10fe7a6be8..4a22c992861837e21eac00b220869b1e56155209 100644 (file)
@@ -405,6 +405,10 @@ config CMDLINE
          most cases you will need to specify the root device here.
 
 if !44x || BROKEN
+config ARCH_WANTS_FREEZER_CONTROL
+       def_bool y
+       depends on ADB_PMU
+
 source kernel/power/Kconfig
 endif
 
index f8153fda06bbda9297d6133df1dd4a161e1ffb82..ef9b802738a522851d7e95672164f83a997d8df6 100644 (file)
@@ -104,6 +104,17 @@ config SUSPEND
          powered and thus its contents are preserved, such as the
          suspend-to-RAM state (e.g. the ACPI S3 state).
 
+config SUSPEND_FREEZER
+       bool "Enable freezer for suspend to RAM/standby" \
+               if ARCH_WANTS_FREEZER_CONTROL || BROKEN
+       depends on SUSPEND
+       default y
+       help
+         This allows you to turn off the freezer for suspend. If this is
+         done, no tasks are frozen for suspend to RAM/standby.
+
+         Turning OFF this setting is NOT recommended! If in doubt, say Y.
+
 config HIBERNATION
        bool "Hibernation (aka 'suspend to disk')"
        depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
index d9bba452764b4c95f055bfc0a1280bb3b9484af3..e47214cfeb2d43a4d8c044e9b7b82b24cec20c97 100644 (file)
@@ -181,7 +181,7 @@ static int suspend_prepare(void)
 
        pm_prepare_console();
 
-       if (freeze_processes()) {
+       if (suspend_freeze_processes()) {
                error = -EAGAIN;
                goto Thaw;
        }
@@ -199,7 +199,7 @@ static int suspend_prepare(void)
                return 0;
 
  Thaw:
-       thaw_processes();
+       suspend_thaw_processes();
        pm_restore_console();
  Finish:
        pm_notifier_call_chain(PM_POST_SUSPEND);
@@ -308,7 +308,7 @@ int suspend_devices_and_enter(suspend_state_t state)
  */
 static void suspend_finish(void)
 {
-       thaw_processes();
+       suspend_thaw_processes();
        pm_restore_console();
        pm_notifier_call_chain(PM_POST_SUSPEND);
 }
index 8ec5499c5ce180c0567919c5915b7d19eb21a597..700f44ec84067860cb86a79ff8201934c3c59e66 100644 (file)
@@ -1,6 +1,7 @@
 #include <linux/suspend.h>
 #include <linux/suspend_ioctls.h>
 #include <linux/utsname.h>
+#include <linux/freezer.h>
 
 struct swsusp_info {
        struct new_utsname      uts;
@@ -203,3 +204,24 @@ enum {
 #define TEST_MAX       (__TEST_AFTER_LAST - 1)
 
 extern int pm_test_level;
+
+#ifdef CONFIG_SUSPEND_FREEZER
+static inline int suspend_freeze_processes(void)
+{
+       return freeze_processes();
+}
+
+static inline void suspend_thaw_processes(void)
+{
+       thaw_processes();
+}
+#else
+static inline int suspend_freeze_processes(void)
+{
+       return 0;
+}
+
+static inline void suspend_thaw_processes(void)
+{
+}
+#endif