summaryrefslogtreecommitdiff
path: root/drivers/char/vt.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2007-04-12 17:50:03 (GMT)
committerPaul Mackerras <paulus@samba.org>2007-04-12 17:50:03 (GMT)
commite049d1ca3094f3d1d94617f456a9961202f96e3a (patch)
treea30397ad22f2fbea268bd28fa69c60aad9dfa62a /drivers/char/vt.c
parentedfac96a92b88d3b0b53e3f8231b74beee9ecd1d (diff)
parent80584ff3b99c36ead7e130e453b3a48b18072d18 (diff)
downloadlinux-e049d1ca3094f3d1d94617f456a9961202f96e3a.tar.xz
Merge branch 'linux-2.6' into for-2.6.22
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r--drivers/char/vt.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index c3f8e38..1bbb45b 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -724,6 +724,7 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
return -ENOMEM;
memset(vc, 0, sizeof(*vc));
vc_cons[currcons].d = vc;
+ INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
visual_init(vc, currcons, 1);
if (!*vc->vc_uni_pagedir_loc)
con_set_default_unimap(vc);
@@ -2185,10 +2186,28 @@ static void console_callback(struct work_struct *ignored)
release_console_sem();
}
-void set_console(int nr)
+int set_console(int nr)
{
+ struct vc_data *vc = vc_cons[fg_console].d;
+
+ if (!vc_cons_allocated(nr) || vt_dont_switch ||
+ (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) {
+
+ /*
+ * Console switch will fail in console_callback() or
+ * change_console() so there is no point scheduling
+ * the callback
+ *
+ * Existing set_console() users don't check the return
+ * value so this shouldn't break anything
+ */
+ return -EINVAL;
+ }
+
want_console = nr;
schedule_console_callback();
+
+ return 0;
}
struct tty_driver *console_driver;