Suspend: Add config option to disable the freezer if architecture wants that

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>

authored by Johannes Berg and committed by Len Brown b28f5081 c9b6c8f6

+40 -3
+4
arch/powerpc/Kconfig
··· 405 most cases you will need to specify the root device here. 406 407 if !44x || BROKEN 408 source kernel/power/Kconfig 409 endif 410
··· 405 most cases you will need to specify the root device here. 406 407 if !44x || BROKEN 408 + config ARCH_WANTS_FREEZER_CONTROL 409 + def_bool y 410 + depends on ADB_PMU 411 + 412 source kernel/power/Kconfig 413 endif 414
+11
kernel/power/Kconfig
··· 104 powered and thus its contents are preserved, such as the 105 suspend-to-RAM state (e.g. the ACPI S3 state). 106 107 config HIBERNATION 108 bool "Hibernation (aka 'suspend to disk')" 109 depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
··· 104 powered and thus its contents are preserved, such as the 105 suspend-to-RAM state (e.g. the ACPI S3 state). 106 107 + config SUSPEND_FREEZER 108 + bool "Enable freezer for suspend to RAM/standby" \ 109 + if ARCH_WANTS_FREEZER_CONTROL || BROKEN 110 + depends on SUSPEND 111 + default y 112 + help 113 + This allows you to turn off the freezer for suspend. If this is 114 + done, no tasks are frozen for suspend to RAM/standby. 115 + 116 + Turning OFF this setting is NOT recommended! If in doubt, say Y. 117 + 118 config HIBERNATION 119 bool "Hibernation (aka 'suspend to disk')" 120 depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
+3 -3
kernel/power/main.c
··· 181 182 pm_prepare_console(); 183 184 - if (freeze_processes()) { 185 error = -EAGAIN; 186 goto Thaw; 187 } ··· 199 return 0; 200 201 Thaw: 202 - thaw_processes(); 203 pm_restore_console(); 204 Finish: 205 pm_notifier_call_chain(PM_POST_SUSPEND); ··· 308 */ 309 static void suspend_finish(void) 310 { 311 - thaw_processes(); 312 pm_restore_console(); 313 pm_notifier_call_chain(PM_POST_SUSPEND); 314 }
··· 181 182 pm_prepare_console(); 183 184 + if (suspend_freeze_processes()) { 185 error = -EAGAIN; 186 goto Thaw; 187 } ··· 199 return 0; 200 201 Thaw: 202 + suspend_thaw_processes(); 203 pm_restore_console(); 204 Finish: 205 pm_notifier_call_chain(PM_POST_SUSPEND); ··· 308 */ 309 static void suspend_finish(void) 310 { 311 + suspend_thaw_processes(); 312 pm_restore_console(); 313 pm_notifier_call_chain(PM_POST_SUSPEND); 314 }
+22
kernel/power/power.h
··· 1 #include <linux/suspend.h> 2 #include <linux/suspend_ioctls.h> 3 #include <linux/utsname.h> 4 5 struct swsusp_info { 6 struct new_utsname uts; ··· 204 #define TEST_MAX (__TEST_AFTER_LAST - 1) 205 206 extern int pm_test_level;
··· 1 #include <linux/suspend.h> 2 #include <linux/suspend_ioctls.h> 3 #include <linux/utsname.h> 4 + #include <linux/freezer.h> 5 6 struct swsusp_info { 7 struct new_utsname uts; ··· 203 #define TEST_MAX (__TEST_AFTER_LAST - 1) 204 205 extern int pm_test_level; 206 + 207 + #ifdef CONFIG_SUSPEND_FREEZER 208 + static inline int suspend_freeze_processes(void) 209 + { 210 + return freeze_processes(); 211 + } 212 + 213 + static inline void suspend_thaw_processes(void) 214 + { 215 + thaw_processes(); 216 + } 217 + #else 218 + static inline int suspend_freeze_processes(void) 219 + { 220 + return 0; 221 + } 222 + 223 + static inline void suspend_thaw_processes(void) 224 + { 225 + } 226 + #endif