aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/vt.c
diff options
context:
space:
mode:
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 c3f8e383933b..1bbb45b937fd 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 */
724 return -ENOMEM; 724 return -ENOMEM;
725 memset(vc, 0, sizeof(*vc)); 725 memset(vc, 0, sizeof(*vc));
726 vc_cons[currcons].d = vc; 726 vc_cons[currcons].d = vc;
727 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
727 visual_init(vc, currcons, 1); 728 visual_init(vc, currcons, 1);
728 if (!*vc->vc_uni_pagedir_loc) 729 if (!*vc->vc_uni_pagedir_loc)
729 con_set_default_unimap(vc); 730 con_set_default_unimap(vc);
@@ -2185,10 +2186,28 @@ static void console_callback(struct work_struct *ignored)
2185 release_console_sem(); 2186 release_console_sem();
2186} 2187}
2187 2188
2188void set_console(int nr) 2189int set_console(int nr)
2189{ 2190{
2191 struct vc_data *vc = vc_cons[fg_console].d;
2192
2193 if (!vc_cons_allocated(nr) || vt_dont_switch ||
2194 (vc->vt_mode.mode == VT_AUTO && vc->vc_mode == KD_GRAPHICS)) {
2195
2196 /*
2197 * Console switch will fail in console_callback() or
2198 * change_console() so there is no point scheduling
2199 * the callback
2200 *
2201 * Existing set_console() users don't check the return
2202 * value so this shouldn't break anything
2203 */
2204 return -EINVAL;
2205 }
2206
2190 want_console = nr; 2207 want_console = nr;
2191 schedule_console_callback(); 2208 schedule_console_callback();
2209
2210 return 0;
2192} 2211}
2193 2212
2194struct tty_driver *console_driver; 2213struct tty_driver *console_driver;