* [PATCH 1/2] Suspend: Clean up suspend_64.c
2007-12-16 22:46 [PATCH 0/2] Suspend: More cleanups Rafael J. Wysocki
@ 2007-12-16 23:30 ` Rafael J. Wysocki
2007-12-17 0:26 ` Pavel Machek
2007-12-16 23:30 ` [PATCH 2/2] Suspend: Add config option to disable the freezer if architecture wants that Rafael J. Wysocki
1 sibling, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2007-12-16 23:30 UTC (permalink / raw)
To: Len Brown; +Cc: Pavel Machek, ACPI Devel Maling List, linux-pm, Borislav Petkov
From: Borislav Petkov <bbpetkov@yahoo.de>
There's a freakishly long comment in suspend_64.c, shorten it.
Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
arch/x86/kernel/suspend_64.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: linux-2.6/arch/x86/kernel/suspend_64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/suspend_64.c
+++ linux-2.6/arch/x86/kernel/suspend_64.c
@@ -118,7 +118,12 @@ void fix_processor_context(void)
int cpu = smp_processor_id();
struct tss_struct *t = &per_cpu(init_tss, cpu);
- set_tss_desc(cpu,t); /* This just modifies memory; should not be necessary. But... This is necessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
+ /*
+ * This just modifies memory; should not be necessary. But... This
+ * is necessary, because 386 hardware has concept of busy TSS or some
+ * similar stupidity.
+ */
+ set_tss_desc(cpu, t);
cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9;
@@ -138,7 +143,6 @@ void fix_processor_context(void)
loaddebug(¤t->thread, 6);
loaddebug(¤t->thread, 7);
}
-
}
#ifdef CONFIG_HIBERNATION
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 2/2] Suspend: Add config option to disable the freezer if architecture wants that
2007-12-16 22:46 [PATCH 0/2] Suspend: More cleanups Rafael J. Wysocki
2007-12-16 23:30 ` [PATCH 1/2] Suspend: Clean up suspend_64.c Rafael J. Wysocki
@ 2007-12-16 23:30 ` Rafael J. Wysocki
2007-12-17 0:26 ` Pavel Machek
1 sibling, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2007-12-16 23:30 UTC (permalink / raw)
To: Len Brown; +Cc: Pavel Machek, ACPI Devel Maling List, linux-pm, Johannes Berg
From: Johannes Berg <johannes@sipsolutions.net>
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>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
In a quick test, playing sound across suspend failed to work,
it usually works when the freezer is enabled (unless you use
gstreamer.)
arch/powerpc/Kconfig | 4 ++++
kernel/power/Kconfig | 11 +++++++++++
kernel/power/main.c | 6 +++---
kernel/power/power.h | 22 ++++++++++++++++++++++
4 files changed, 40 insertions(+), 3 deletions(-)
Index: linux-2.6/kernel/power/main.c
===================================================================
--- linux-2.6.orig/kernel/power/main.c
+++ linux-2.6/kernel/power/main.c
@@ -176,7 +176,7 @@ static int suspend_prepare(void)
pm_prepare_console();
- if (freeze_processes()) {
+ if (suspend_freeze_processes()) {
error = -EAGAIN;
goto Thaw;
}
@@ -194,7 +194,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);
@@ -300,7 +300,7 @@ int suspend_devices_and_enter(suspend_st
*/
static void suspend_finish(void)
{
- thaw_processes();
+ suspend_thaw_processes();
pm_restore_console();
pm_notifier_call_chain(PM_POST_SUSPEND);
}
Index: linux-2.6/kernel/power/Kconfig
===================================================================
--- linux-2.6.orig/kernel/power/Kconfig
+++ linux-2.6/kernel/power/Kconfig
@@ -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: linux-2.6/arch/powerpc/Kconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/Kconfig
+++ linux-2.6/arch/powerpc/Kconfig
@@ -384,6 +384,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: linux-2.6/kernel/power/power.h
===================================================================
--- linux-2.6.orig/kernel/power/power.h
+++ linux-2.6/kernel/power/power.h
@@ -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;
@@ -205,3 +206,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
^ permalink raw reply [flat|nested] 7+ messages in thread