[PATCH 6/7] pm: Config option to disable handling of console during suspend/resume

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ben Collins
Date: Sunday, July 20, 2008 - 6:48 pm

Config option allows userspace to handle console during suspend/resume
instead of the kernel.

Signed-off-by: Ben Collins <ben.collins@canonical.com>
---
 kernel/power/Kconfig   |   15 +++++++++++++++
 kernel/power/console.c |    4 ++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index b45da40..6855299 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -105,6 +105,21 @@ config SUSPEND_FREEZER
 
 	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
+config PM_DISABLE_CONSOLE
+	bool "Disable Power Management messing with the active console"
+	depends on PM
+	default n
+	---help---
+	  By default, PM will take over the active console (generally, this means
+	  switching to the console when suspending from X). This can at times cause
+	  problems, especially if userspace suspend scripts try to do things with
+	  the console before or after suspending (e.g. calling vbestate).
+
+	  To work around this, enable this option so that PM will not handle the
+	  console.
+
+	  If unsure, say N.
+
 config HIBERNATION
 	bool "Hibernation (aka 'suspend to disk')"
 	depends on PM && SWAP && ARCH_HIBERNATION_POSSIBLE
diff --git a/kernel/power/console.c b/kernel/power/console.c
index b8628be..8b9706f 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -33,6 +33,7 @@ EXPORT_SYMBOL(pm_set_vt_switch);
 
 int pm_prepare_console(void)
 {
+#ifndef CONFIG_PM_DISABLE_CONSOLE
 	acquire_console_sem();
 
 	if (disable_vt_switch) {
@@ -66,11 +67,13 @@ int pm_prepare_console(void)
 	}
 	orig_kmsg = kmsg_redirect;
 	kmsg_redirect = SUSPEND_CONSOLE;
+#endif
 	return 0;
 }
 
 void pm_restore_console(void)
 {
+#ifndef CONFIG_PM_DISABLE_CONSOLE
 	acquire_console_sem();
 	if (disable_vt_switch) {
 		release_console_sem();
@@ -79,5 +82,6 @@ void pm_restore_console(void)
 	set_console(orig_fgconsole);
 	release_console_sem();
 	kmsg_redirect = orig_kmsg;
+#endif
 }
 #endif
-- 
1.5.4.3

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/7] Patches from Ubuntu kernel tree, Ben Collins, (Wed Jan 2, 8:57 am)
kill misleading comments in trampoline_*.S, Pavel Machek, (Thu Jan 31, 5:54 pm)
Re: kill misleading comments in trampoline_*.S, Yinghai Lu, (Thu Jan 31, 6:02 pm)
Re: kill misleading comments in trampoline_*.S, Pavel Machek, (Thu Jan 31, 6:05 pm)
Re: kill misleading comments in trampoline_*.S, Ingo Molnar, (Fri Feb 1, 4:16 am)
[PATCH 4/7] irda: Default to dongle type 9 on IBM hardware, Matthew Garrett, (Sun Jul 20, 2:08 pm)
[PATCH 7/7] HID: Add quirks for fourth generation MacBooks ..., Alexandre Karpenko, (Sun Jul 20, 2:44 pm)
[PATCH 6/7] pm: Config option to disable handling of conso ..., Ben Collins, (Sun Jul 20, 6:48 pm)
Re: [PATCH 0/7] Patches from Ubuntu kernel tree, Greg KH, (Mon Jul 28, 8:35 pm)
Re: [PATCH 6/7] pm: Config option to disable handling of c ..., Rafael J. Wysocki, (Tue Jul 29, 2:15 pm)
Re: [PATCH 6/7] pm: Config option to disable handling of c ..., Rafael J. Wysocki, (Tue Jul 29, 3:18 pm)
Re: [PATCH 4/7] nsc-ircc: Default to dongle type 9 on IBM ..., Matthew Garrett, (Tue Jul 29, 10:11 pm)