diff options
author | Andres Salomon <dilinger@debian.org> | 2008-04-24 13:30:02 -0400 |
---|---|---|
committer | Andres Salomon <dilinger@debian.org> | 2008-04-24 13:30:02 -0400 |
commit | 4964b01bdb72200b45629e98e128561f96f0781c (patch) | |
tree | 1e2d890e943a1478a825c2200ce5f1a685a98b78 /kernel | |
parent | 870f830b1f0548d250e3026eb44a43db4ae6ea5d (diff) | |
download | lwn-4964b01bdb72200b45629e98e128561f96f0781c.tar.gz lwn-4964b01bdb72200b45629e98e128561f96f0781c.zip |
Merge in hotness from upstream.
Signed-off-by: Andres Salomon <dilinger@debian.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/Kconfig | 12 | ||||
-rw-r--r-- | kernel/power/console.c | 23 |
2 files changed, 22 insertions, 13 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 8db07bd2d156..79833170bb9c 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -37,18 +37,6 @@ config PM_DEBUG code. This is helpful when debugging and reporting PM bugs, like suspend support. -config DISABLE_SUSPEND_VT_SWITCH - bool "Disable the console switch prior to suspend (DANGEROUS)" - depends on VT_CONSOLE && PM && EXPERIMENTAL - ---help--- - This option disables the automatic switch to VT console that happens - prior to Linux going into a suspend/sleep. Your video card/framebuffer - must be able to properly restore the display (even if X is doing - something crazy!) in this scenario. This is useful for saving - precious milliseconds during suspend and resume. - - If unsure, say N. - config PM_VERBOSE bool "Verbose Power Management debugging" depends on PM_DEBUG diff --git a/kernel/power/console.c b/kernel/power/console.c index dca98f59b7cb..71ed4aa95fdc 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c @@ -7,15 +7,33 @@ #include <linux/vt_kern.h> #include <linux/kbd_kern.h> #include <linux/console.h> +#include <linux/module.h> #include "power.h" -#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) && !defined(CONFIG_DISABLE_SUSPEND_VT_SWITCH) +#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE) #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) static int orig_fgconsole, orig_kmsg; +static int disable_vt_switch; + +/* + * Normally during a suspend, we allocate a new console and switch to it. + * When we resume, we switch back to the original console. This switch + * can be slow, so on systems where the framebuffer can handle restoration + * of video registers anyways, there's little point in doing the console + * switch. This function allows you to disable it by passing it '0'. + */ +void pm_set_vt_switch(int do_switch) +{ + disable_vt_switch = !do_switch; +} +EXPORT_SYMBOL(pm_set_vt_switch); int pm_prepare_console(void) { + if (disable_vt_switch) + return 0; + acquire_console_sem(); orig_fgconsole = fg_console; @@ -49,6 +67,9 @@ int pm_prepare_console(void) void pm_restore_console(void) { + if (disable_vt_switch) + return; + acquire_console_sem(); set_console(orig_fgconsole); release_console_sem(); |