Blame view

kernel/power/console.c 614 Bytes
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
37cce26b3   H Hartley Sweeten   PM / VT: Cleanup ...
2
   * Functions for saving/restoring console.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
3
4
5
6
7
8
   *
   * Originally from swsusp.
   */
  
  #include <linux/vt_kern.h>
  #include <linux/kbd_kern.h>
5ada918b8   Bernhard Walle   vt: introduce and...
9
  #include <linux/vt.h>
b6f448e99   Andres Salomon   PM/gxfb: add hook...
10
  #include <linux/module.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
  #include "power.h"
46cd2f32b   Rafael J. Wysocki   [PATCH] Fix build...
12
  #define SUSPEND_CONSOLE	(MAX_NR_CONSOLES-1)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
  static int orig_fgconsole, orig_kmsg;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
15
16
  
  int pm_prepare_console(void)
  {
8d233558c   Alan Cox   vt: remove power ...
17
18
  	orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1);
  	if (orig_fgconsole < 0)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19
  		return 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20

5ada918b8   Bernhard Walle   vt: introduce and...
21
  	orig_kmsg = vt_kmsg_redirect(SUSPEND_CONSOLE);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
22
23
24
25
26
  	return 0;
  }
  
  void pm_restore_console(void)
  {
8d233558c   Alan Cox   vt: remove power ...
27
28
  	if (orig_fgconsole >= 0) {
  		vt_move_to_console(orig_fgconsole, 0);
5ada918b8   Bernhard Walle   vt: introduce and...
29
  		vt_kmsg_redirect(orig_kmsg);
b090f9fa5   Arve Hjønnevåg   PM: Wait for cons...
30
  	}
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
  }