aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-09-19 16:13:25 -0400
committerLive-CD User <linux@linux.site>2009-09-19 16:13:25 -0400
commit8d233558cd99a888571bb5a88a74970879e0aba4 (patch)
treea5a39a0faff85cd26ed3dc7aa7e7ee4406677fdb /drivers/char
parent8b92e87d39bfd046e7581e1fe0f40eac40f88608 (diff)
vt: remove power stuff from kernel/power
In the past someone gratuitiously borrowed chunks of kernel internal vt code and dumped them in kernel/power. They have all sorts of deep relations with the vt code so put them in the vt tree instead Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/vt_ioctl.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
index 35ad94e65d0d..d29fbd44bdca 100644
--- a/drivers/char/vt_ioctl.c
+++ b/drivers/char/vt_ioctl.c
@@ -16,6 +16,7 @@
16#include <linux/tty.h> 16#include <linux/tty.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/module.h>
19#include <linux/kd.h> 20#include <linux/kd.h>
20#include <linux/vt.h> 21#include <linux/vt.h>
21#include <linux/string.h> 22#include <linux/string.h>
@@ -1483,3 +1484,58 @@ void change_console(struct vc_data *new_vc)
1483 1484
1484 complete_change_console(new_vc); 1485 complete_change_console(new_vc);
1485} 1486}
1487
1488/* Perform a kernel triggered VT switch for suspend/resume */
1489
1490static int disable_vt_switch;
1491
1492int vt_move_to_console(unsigned int vt, int alloc)
1493{
1494 int prev;
1495
1496 acquire_console_sem();
1497 /* Graphics mode - up to X */
1498 if (disable_vt_switch) {
1499 release_console_sem();
1500 return 0;
1501 }
1502 prev = fg_console;
1503
1504 if (alloc && vc_allocate(vt)) {
1505 /* we can't have a free VC for now. Too bad,
1506 * we don't want to mess the screen for now. */
1507 release_console_sem();
1508 return -ENOSPC;
1509 }
1510
1511 if (set_console(vt)) {
1512 /*
1513 * We're unable to switch to the SUSPEND_CONSOLE.
1514 * Let the calling function know so it can decide
1515 * what to do.
1516 */
1517 release_console_sem();
1518 return -EIO;
1519 }
1520 release_console_sem();
1521 if (vt_waitactive(vt)) {
1522 pr_debug("Suspend: Can't switch VCs.");
1523 return -EINTR;
1524 }
1525 return prev;
1526}
1527
1528/*
1529 * Normally during a suspend, we allocate a new console and switch to it.
1530 * When we resume, we switch back to the original console. This switch
1531 * can be slow, so on systems where the framebuffer can handle restoration
1532 * of video registers anyways, there's little point in doing the console
1533 * switch. This function allows you to disable it by passing it '0'.
1534 */
1535void pm_set_vt_switch(int do_switch)
1536{
1537 acquire_console_sem();
1538 disable_vt_switch = !do_switch;
1539 release_console_sem();
1540}
1541EXPORT_SYMBOL(pm_set_vt_switch);