Skip to content

Commit b28f508

Browse files
jmberglenb
authored andcommitted
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>
1 parent c9b6c8f commit b28f508

4 files changed

Lines changed: 40 additions & 3 deletions

File tree

‎arch/powerpc/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,10 @@ config CMDLINE
405405
most cases you will need to specify the root device here.
406406

407407
if !44x || BROKEN
408+
config ARCH_WANTS_FREEZER_CONTROL
409+
def_bool y
410+
depends on ADB_PMU
411+
408412
source kernel/power/Kconfig
409413
endif
410414

‎kernel/power/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ config SUSPEND
104104
powered and thus its contents are preserved, such as the
105105
suspend-to-RAM state (e.g. the ACPI S3 state).
106106

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+
107118
config HIBERNATION
108119
bool "Hibernation (aka 'suspend to disk')"
109120
depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE

‎kernel/power/main.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static int suspend_prepare(void)
181181

182182
pm_prepare_console();
183183

184-
if (freeze_processes()) {
184+
if (suspend_freeze_processes()) {
185185
error = -EAGAIN;
186186
goto Thaw;
187187
}
@@ -199,7 +199,7 @@ static int suspend_prepare(void)
199199
return 0;
200200

201201
Thaw:
202-
thaw_processes();
202+
suspend_thaw_processes();
203203
pm_restore_console();
204204
Finish:
205205
pm_notifier_call_chain(PM_POST_SUSPEND);
@@ -308,7 +308,7 @@ int suspend_devices_and_enter(suspend_state_t state)
308308
*/
309309
static void suspend_finish(void)
310310
{
311-
thaw_processes();
311+
suspend_thaw_processes();
312312
pm_restore_console();
313313
pm_notifier_call_chain(PM_POST_SUSPEND);
314314
}

‎kernel/power/power.h‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <linux/suspend.h>
22
#include <linux/suspend_ioctls.h>
33
#include <linux/utsname.h>
4+
#include <linux/freezer.h>
45

56
struct swsusp_info {
67
struct new_utsname uts;
@@ -203,3 +204,24 @@ enum {
203204
#define TEST_MAX (__TEST_AFTER_LAST - 1)
204205

205206
extern int pm_test_level;
207+
208+
#ifdef CONFIG_SUSPEND_FREEZER
209+
static inline int suspend_freeze_processes(void)
210+
{
211+
return freeze_processes();
212+
}
213+
214+
static inline void suspend_thaw_processes(void)
215+
{
216+
thaw_processes();
217+
}
218+
#else
219+
static inline int suspend_freeze_processes(void)
220+
{
221+
return 0;
222+
}
223+
224+
static inline void suspend_thaw_processes(void)
225+
{
226+
}
227+
#endif

0 commit comments

Comments
 (0)