37cce26b32
Introduce the config option CONFIG_VT_CONSOLE_SLEEP in order to cleanup the #if defined ugliness for the vt suspend support functions. Note that CONFIG_VT_CONSOLE is already dependant on CONFIG_VT. The function pm_set_vt_switch is actually dependant on CONFIG_VT and not CONFIG_PM_SLEEP. This fixes a compile error when CONFIG_PM_SLEEP is not set: drivers/tty/vt/vt_ioctl.c:1794: error: redefinition of 'pm_set_vt_switch' include/linux/suspend.h:17: error: previous definition of 'pm_set_vt_switch' was here Also, remove the incorrect path from the comment in console.c. [rjw: Replaced #if defined() with #ifdef in suspend.h.] Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
33 lines
614 B
C
33 lines
614 B
C
/*
|
|
* Functions for saving/restoring console.
|
|
*
|
|
* Originally from swsusp.
|
|
*/
|
|
|
|
#include <linux/vt_kern.h>
|
|
#include <linux/kbd_kern.h>
|
|
#include <linux/vt.h>
|
|
#include <linux/module.h>
|
|
#include "power.h"
|
|
|
|
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
|
|
|
|
static int orig_fgconsole, orig_kmsg;
|
|
|
|
int pm_prepare_console(void)
|
|
{
|
|
orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1);
|
|
if (orig_fgconsole < 0)
|
|
return 1;
|
|
|
|
orig_kmsg = vt_kmsg_redirect(SUSPEND_CONSOLE);
|
|
return 0;
|
|
}
|
|
|
|
void pm_restore_console(void)
|
|
{
|
|
if (orig_fgconsole >= 0) {
|
|
vt_move_to_console(orig_fgconsole, 0);
|
|
vt_kmsg_redirect(orig_kmsg);
|
|
}
|
|
}
|