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.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 0900d1dbee59..ca4844c527da 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2489,7 +2489,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2489} 2489}
2490 2490
2491/* 2491/*
2492 * We take tty_sem in here to prevent another thread from coming in via init_dev 2492 * We take tty_mutex in here to prevent another thread from coming in via init_dev
2493 * and taking a ref against the tty while we're in the process of forgetting 2493 * and taking a ref against the tty while we're in the process of forgetting
2494 * about it and cleaning things up. 2494 * about it and cleaning things up.
2495 * 2495 *
@@ -2497,7 +2497,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2497 */ 2497 */
2498static void con_close(struct tty_struct *tty, struct file *filp) 2498static void con_close(struct tty_struct *tty, struct file *filp)
2499{ 2499{
2500 down(&tty_sem); 2500 mutex_lock(&tty_mutex);
2501 acquire_console_sem(); 2501 acquire_console_sem();
2502 if (tty && tty->count == 1) { 2502 if (tty && tty->count == 1) {
2503 struct vc_data *vc = tty->driver_data; 2503 struct vc_data *vc = tty->driver_data;
@@ -2507,15 +2507,15 @@ static void con_close(struct tty_struct *tty, struct file *filp)
2507 tty->driver_data = NULL; 2507 tty->driver_data = NULL;
2508 release_console_sem(); 2508 release_console_sem();
2509 vcs_remove_devfs(tty); 2509 vcs_remove_devfs(tty);
2510 up(&tty_sem); 2510 mutex_unlock(&tty_mutex);
2511 /* 2511 /*
2512 * tty_sem is released, but we still hold BKL, so there is 2512 * tty_mutex is released, but we still hold BKL, so there is
2513 * still exclusion against init_dev() 2513 * still exclusion against init_dev()
2514 */ 2514 */
2515 return; 2515 return;
2516 } 2516 }
2517 release_console_sem(); 2517 release_console_sem();
2518 up(&tty_sem); 2518 mutex_unlock(&tty_mutex);
2519} 2519}
2520 2520
2521static void vc_init(struct vc_data *vc, unsigned int rows, 2521static void vc_init(struct vc_data *vc, unsigned int rows,
@@ -2869,9 +2869,9 @@ void unblank_screen(void)
2869} 2869}
2870 2870
2871/* 2871/*
2872 * We defer the timer blanking to work queue so it can take the console semaphore 2872 * We defer the timer blanking to work queue so it can take the console mutex
2873 * (console operations can still happen at irq time, but only from printk which 2873 * (console operations can still happen at irq time, but only from printk which
2874 * has the console semaphore. Not perfect yet, but better than no locking 2874 * has the console mutex. Not perfect yet, but better than no locking
2875 */ 2875 */
2876static void blank_screen_t(unsigned long dummy) 2876static void blank_screen_t(unsigned long dummy)
2877{ 2877{
@@ -3234,6 +3234,14 @@ void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org)
3234 } 3234 }
3235} 3235}
3236 3236
3237int is_console_suspend_safe(void)
3238{
3239 /* It is unsafe to suspend devices while X has control of the
3240 * hardware. Make sure we are running on a kernel-controlled console.
3241 */
3242 return vc_cons[fg_console].d->vc_mode == KD_TEXT;
3243}
3244
3237/* 3245/*
3238 * Visible symbols for modules 3246 * Visible symbols for modules
3239 */ 3247 */