OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / kernel / power / console.c
blobb1dc456474b57d80664560c202ce027cce73db13
1 /*
2 * Functions for saving/restoring console.
4 * Originally from swsusp.
5 */
7 #include <linux/vt_kern.h>
8 #include <linux/kbd_kern.h>
9 #include <linux/vt.h>
10 #include <linux/module.h>
11 #include "power.h"
13 #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
15 static int orig_fgconsole, orig_kmsg;
17 int pm_prepare_console(void)
19 orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1);
20 if (orig_fgconsole < 0)
21 return 1;
23 orig_kmsg = vt_kmsg_redirect(SUSPEND_CONSOLE);
24 return 0;
27 void pm_restore_console(void)
29 if (orig_fgconsole >= 0) {
30 vt_move_to_console(orig_fgconsole, 0);
31 vt_kmsg_redirect(orig_kmsg);