aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty')
-rw-r--r--drivers/tty/serial/sb1250-duart.c2
-rw-r--r--drivers/tty/tty_io.c4
-rw-r--r--drivers/tty/vt/selection.c4
-rw-r--r--drivers/tty/vt/vc_screen.c16
-rw-r--r--drivers/tty/vt/vt.c124
-rw-r--r--drivers/tty/vt/vt_ioctl.c60
6 files changed, 105 insertions, 105 deletions
diff --git a/drivers/tty/serial/sb1250-duart.c b/drivers/tty/serial/sb1250-duart.c
index a2f2b325449..602d9845c52 100644
--- a/drivers/tty/serial/sb1250-duart.c
+++ b/drivers/tty/serial/sb1250-duart.c
@@ -829,7 +829,7 @@ static void __init sbd_probe_duarts(void)
829#ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE 829#ifdef CONFIG_SERIAL_SB1250_DUART_CONSOLE
830/* 830/*
831 * Serial console stuff. Very basic, polling driver for doing serial 831 * Serial console stuff. Very basic, polling driver for doing serial
832 * console output. The console_sem is held by the caller, so we 832 * console output. The console_lock is held by the caller, so we
833 * shouldn't be interrupted for more console activity. 833 * shouldn't be interrupted for more console activity.
834 */ 834 */
835static void sbd_console_putchar(struct uart_port *uport, int ch) 835static void sbd_console_putchar(struct uart_port *uport, int ch)
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 464d09d9787..6158eae0f64 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -3256,7 +3256,7 @@ static ssize_t show_cons_active(struct device *dev,
3256 struct console *c; 3256 struct console *c;
3257 ssize_t count = 0; 3257 ssize_t count = 0;
3258 3258
3259 acquire_console_sem(); 3259 console_lock();
3260 for (c = console_drivers; c; c = c->next) { 3260 for (c = console_drivers; c; c = c->next) {
3261 if (!c->device) 3261 if (!c->device)
3262 continue; 3262 continue;
@@ -3271,7 +3271,7 @@ static ssize_t show_cons_active(struct device *dev,
3271 while (i--) 3271 while (i--)
3272 count += sprintf(buf + count, "%s%d%c", 3272 count += sprintf(buf + count, "%s%d%c",
3273 cs[i]->name, cs[i]->index, i ? ' ':'\n'); 3273 cs[i]->name, cs[i]->index, i ? ' ':'\n');
3274 release_console_sem(); 3274 console_unlock();
3275 3275
3276 return count; 3276 return count;
3277} 3277}
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
index ebae344ce91..c956ed6c83a 100644
--- a/drivers/tty/vt/selection.c
+++ b/drivers/tty/vt/selection.c
@@ -316,9 +316,9 @@ int paste_selection(struct tty_struct *tty)
316 /* always called with BTM from vt_ioctl */ 316 /* always called with BTM from vt_ioctl */
317 WARN_ON(!tty_locked()); 317 WARN_ON(!tty_locked());
318 318
319 acquire_console_sem(); 319 console_lock();
320 poke_blanked_console(); 320 poke_blanked_console();
321 release_console_sem(); 321 console_unlock();
322 322
323 ld = tty_ldisc_ref(tty); 323 ld = tty_ldisc_ref(tty);
324 if (!ld) { 324 if (!ld) {
diff --git a/drivers/tty/vt/vc_screen.c b/drivers/tty/vt/vc_screen.c
index eab3a1ff99e..a672ed192d3 100644
--- a/drivers/tty/vt/vc_screen.c
+++ b/drivers/tty/vt/vc_screen.c
@@ -202,7 +202,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
202 /* Select the proper current console and verify 202 /* Select the proper current console and verify
203 * sanity of the situation under the console lock. 203 * sanity of the situation under the console lock.
204 */ 204 */
205 acquire_console_sem(); 205 console_lock();
206 206
207 attr = (currcons & 128); 207 attr = (currcons & 128);
208 currcons = (currcons & 127); 208 currcons = (currcons & 127);
@@ -336,9 +336,9 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
336 * the pagefault handling code may want to call printk(). 336 * the pagefault handling code may want to call printk().
337 */ 337 */
338 338
339 release_console_sem(); 339 console_unlock();
340 ret = copy_to_user(buf, con_buf_start, orig_count); 340 ret = copy_to_user(buf, con_buf_start, orig_count);
341 acquire_console_sem(); 341 console_lock();
342 342
343 if (ret) { 343 if (ret) {
344 read += (orig_count - ret); 344 read += (orig_count - ret);
@@ -354,7 +354,7 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
354 if (read) 354 if (read)
355 ret = read; 355 ret = read;
356unlock_out: 356unlock_out:
357 release_console_sem(); 357 console_unlock();
358 mutex_unlock(&con_buf_mtx); 358 mutex_unlock(&con_buf_mtx);
359 return ret; 359 return ret;
360} 360}
@@ -379,7 +379,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
379 /* Select the proper current console and verify 379 /* Select the proper current console and verify
380 * sanity of the situation under the console lock. 380 * sanity of the situation under the console lock.
381 */ 381 */
382 acquire_console_sem(); 382 console_lock();
383 383
384 attr = (currcons & 128); 384 attr = (currcons & 128);
385 currcons = (currcons & 127); 385 currcons = (currcons & 127);
@@ -414,9 +414,9 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
414 /* Temporarily drop the console lock so that we can read 414 /* Temporarily drop the console lock so that we can read
415 * in the write data from userspace safely. 415 * in the write data from userspace safely.
416 */ 416 */
417 release_console_sem(); 417 console_unlock();
418 ret = copy_from_user(con_buf, buf, this_round); 418 ret = copy_from_user(con_buf, buf, this_round);
419 acquire_console_sem(); 419 console_lock();
420 420
421 if (ret) { 421 if (ret) {
422 this_round -= ret; 422 this_round -= ret;
@@ -542,7 +542,7 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
542 vcs_scr_updated(vc); 542 vcs_scr_updated(vc);
543 543
544unlock_out: 544unlock_out:
545 release_console_sem(); 545 console_unlock();
546 546
547 mutex_unlock(&con_buf_mtx); 547 mutex_unlock(&con_buf_mtx);
548 548
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 76407eca9ab..b230bd3f056 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -1003,9 +1003,9 @@ static int vt_resize(struct tty_struct *tty, struct winsize *ws)
1003 struct vc_data *vc = tty->driver_data; 1003 struct vc_data *vc = tty->driver_data;
1004 int ret; 1004 int ret;
1005 1005
1006 acquire_console_sem(); 1006 console_lock();
1007 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row); 1007 ret = vc_do_resize(tty, vc, ws->ws_col, ws->ws_row);
1008 release_console_sem(); 1008 console_unlock();
1009 return ret; 1009 return ret;
1010} 1010}
1011 1011
@@ -1271,7 +1271,7 @@ static void default_attr(struct vc_data *vc)
1271 vc->vc_color = vc->vc_def_color; 1271 vc->vc_color = vc->vc_def_color;
1272} 1272}
1273 1273
1274/* console_sem is held */ 1274/* console_lock is held */
1275static void csi_m(struct vc_data *vc) 1275static void csi_m(struct vc_data *vc)
1276{ 1276{
1277 int i; 1277 int i;
@@ -1415,7 +1415,7 @@ int mouse_reporting(void)
1415 return vc_cons[fg_console].d->vc_report_mouse; 1415 return vc_cons[fg_console].d->vc_report_mouse;
1416} 1416}
1417 1417
1418/* console_sem is held */ 1418/* console_lock is held */
1419static void set_mode(struct vc_data *vc, int on_off) 1419static void set_mode(struct vc_data *vc, int on_off)
1420{ 1420{
1421 int i; 1421 int i;
@@ -1485,7 +1485,7 @@ static void set_mode(struct vc_data *vc, int on_off)
1485 } 1485 }
1486} 1486}
1487 1487
1488/* console_sem is held */ 1488/* console_lock is held */
1489static void setterm_command(struct vc_data *vc) 1489static void setterm_command(struct vc_data *vc)
1490{ 1490{
1491 switch(vc->vc_par[0]) { 1491 switch(vc->vc_par[0]) {
@@ -1545,7 +1545,7 @@ static void setterm_command(struct vc_data *vc)
1545 } 1545 }
1546} 1546}
1547 1547
1548/* console_sem is held */ 1548/* console_lock is held */
1549static void csi_at(struct vc_data *vc, unsigned int nr) 1549static void csi_at(struct vc_data *vc, unsigned int nr)
1550{ 1550{
1551 if (nr > vc->vc_cols - vc->vc_x) 1551 if (nr > vc->vc_cols - vc->vc_x)
@@ -1555,7 +1555,7 @@ static void csi_at(struct vc_data *vc, unsigned int nr)
1555 insert_char(vc, nr); 1555 insert_char(vc, nr);
1556} 1556}
1557 1557
1558/* console_sem is held */ 1558/* console_lock is held */
1559static void csi_L(struct vc_data *vc, unsigned int nr) 1559static void csi_L(struct vc_data *vc, unsigned int nr)
1560{ 1560{
1561 if (nr > vc->vc_rows - vc->vc_y) 1561 if (nr > vc->vc_rows - vc->vc_y)
@@ -1566,7 +1566,7 @@ static void csi_L(struct vc_data *vc, unsigned int nr)
1566 vc->vc_need_wrap = 0; 1566 vc->vc_need_wrap = 0;
1567} 1567}
1568 1568
1569/* console_sem is held */ 1569/* console_lock is held */
1570static void csi_P(struct vc_data *vc, unsigned int nr) 1570static void csi_P(struct vc_data *vc, unsigned int nr)
1571{ 1571{
1572 if (nr > vc->vc_cols - vc->vc_x) 1572 if (nr > vc->vc_cols - vc->vc_x)
@@ -1576,7 +1576,7 @@ static void csi_P(struct vc_data *vc, unsigned int nr)
1576 delete_char(vc, nr); 1576 delete_char(vc, nr);
1577} 1577}
1578 1578
1579/* console_sem is held */ 1579/* console_lock is held */
1580static void csi_M(struct vc_data *vc, unsigned int nr) 1580static void csi_M(struct vc_data *vc, unsigned int nr)
1581{ 1581{
1582 if (nr > vc->vc_rows - vc->vc_y) 1582 if (nr > vc->vc_rows - vc->vc_y)
@@ -1587,7 +1587,7 @@ static void csi_M(struct vc_data *vc, unsigned int nr)
1587 vc->vc_need_wrap = 0; 1587 vc->vc_need_wrap = 0;
1588} 1588}
1589 1589
1590/* console_sem is held (except via vc_init->reset_terminal */ 1590/* console_lock is held (except via vc_init->reset_terminal */
1591static void save_cur(struct vc_data *vc) 1591static void save_cur(struct vc_data *vc)
1592{ 1592{
1593 vc->vc_saved_x = vc->vc_x; 1593 vc->vc_saved_x = vc->vc_x;
@@ -1603,7 +1603,7 @@ static void save_cur(struct vc_data *vc)
1603 vc->vc_saved_G1 = vc->vc_G1_charset; 1603 vc->vc_saved_G1 = vc->vc_G1_charset;
1604} 1604}
1605 1605
1606/* console_sem is held */ 1606/* console_lock is held */
1607static void restore_cur(struct vc_data *vc) 1607static void restore_cur(struct vc_data *vc)
1608{ 1608{
1609 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y); 1609 gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y);
@@ -1625,7 +1625,7 @@ enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
1625 EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd, 1625 EShash, ESsetG0, ESsetG1, ESpercent, ESignore, ESnonstd,
1626 ESpalette }; 1626 ESpalette };
1627 1627
1628/* console_sem is held (except via vc_init()) */ 1628/* console_lock is held (except via vc_init()) */
1629static void reset_terminal(struct vc_data *vc, int do_clear) 1629static void reset_terminal(struct vc_data *vc, int do_clear)
1630{ 1630{
1631 vc->vc_top = 0; 1631 vc->vc_top = 0;
@@ -1685,7 +1685,7 @@ static void reset_terminal(struct vc_data *vc, int do_clear)
1685 csi_J(vc, 2); 1685 csi_J(vc, 2);
1686} 1686}
1687 1687
1688/* console_sem is held */ 1688/* console_lock is held */
1689static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) 1689static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
1690{ 1690{
1691 /* 1691 /*
@@ -2119,7 +2119,7 @@ static int is_double_width(uint32_t ucs)
2119 return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1); 2119 return bisearch(ucs, double_width, ARRAY_SIZE(double_width) - 1);
2120} 2120}
2121 2121
2122/* acquires console_sem */ 2122/* acquires console_lock */
2123static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) 2123static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count)
2124{ 2124{
2125#ifdef VT_BUF_VRAM_ONLY 2125#ifdef VT_BUF_VRAM_ONLY
@@ -2147,11 +2147,11 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
2147 2147
2148 might_sleep(); 2148 might_sleep();
2149 2149
2150 acquire_console_sem(); 2150 console_lock();
2151 vc = tty->driver_data; 2151 vc = tty->driver_data;
2152 if (vc == NULL) { 2152 if (vc == NULL) {
2153 printk(KERN_ERR "vt: argh, driver_data is NULL !\n"); 2153 printk(KERN_ERR "vt: argh, driver_data is NULL !\n");
2154 release_console_sem(); 2154 console_unlock();
2155 return 0; 2155 return 0;
2156 } 2156 }
2157 2157
@@ -2159,7 +2159,7 @@ static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int co
2159 if (!vc_cons_allocated(currcons)) { 2159 if (!vc_cons_allocated(currcons)) {
2160 /* could this happen? */ 2160 /* could this happen? */
2161 printk_once("con_write: tty %d not allocated\n", currcons+1); 2161 printk_once("con_write: tty %d not allocated\n", currcons+1);
2162 release_console_sem(); 2162 console_unlock();
2163 return 0; 2163 return 0;
2164 } 2164 }
2165 2165
@@ -2375,7 +2375,7 @@ rescan_last_byte:
2375 } 2375 }
2376 FLUSH 2376 FLUSH
2377 console_conditional_schedule(); 2377 console_conditional_schedule();
2378 release_console_sem(); 2378 console_unlock();
2379 notify_update(vc); 2379 notify_update(vc);
2380 return n; 2380 return n;
2381#undef FLUSH 2381#undef FLUSH
@@ -2388,11 +2388,11 @@ rescan_last_byte:
2388 * us to do the switches asynchronously (needed when we want 2388 * us to do the switches asynchronously (needed when we want
2389 * to switch due to a keyboard interrupt). Synchronization 2389 * to switch due to a keyboard interrupt). Synchronization
2390 * with other console code and prevention of re-entrancy is 2390 * with other console code and prevention of re-entrancy is
2391 * ensured with console_sem. 2391 * ensured with console_lock.
2392 */ 2392 */
2393static void console_callback(struct work_struct *ignored) 2393static void console_callback(struct work_struct *ignored)
2394{ 2394{
2395 acquire_console_sem(); 2395 console_lock();
2396 2396
2397 if (want_console >= 0) { 2397 if (want_console >= 0) {
2398 if (want_console != fg_console && 2398 if (want_console != fg_console &&
@@ -2422,7 +2422,7 @@ static void console_callback(struct work_struct *ignored)
2422 } 2422 }
2423 notify_update(vc_cons[fg_console].d); 2423 notify_update(vc_cons[fg_console].d);
2424 2424
2425 release_console_sem(); 2425 console_unlock();
2426} 2426}
2427 2427
2428int set_console(int nr) 2428int set_console(int nr)
@@ -2603,7 +2603,7 @@ static struct console vt_console_driver = {
2603 */ 2603 */
2604 2604
2605/* 2605/*
2606 * Generally a bit racy with respect to console_sem(). 2606 * Generally a bit racy with respect to console_lock();.
2607 * 2607 *
2608 * There are some functions which don't need it. 2608 * There are some functions which don't need it.
2609 * 2609 *
@@ -2629,17 +2629,17 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
2629 switch (type) 2629 switch (type)
2630 { 2630 {
2631 case TIOCL_SETSEL: 2631 case TIOCL_SETSEL:
2632 acquire_console_sem(); 2632 console_lock();
2633 ret = set_selection((struct tiocl_selection __user *)(p+1), tty); 2633 ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
2634 release_console_sem(); 2634 console_unlock();
2635 break; 2635 break;
2636 case TIOCL_PASTESEL: 2636 case TIOCL_PASTESEL:
2637 ret = paste_selection(tty); 2637 ret = paste_selection(tty);
2638 break; 2638 break;
2639 case TIOCL_UNBLANKSCREEN: 2639 case TIOCL_UNBLANKSCREEN:
2640 acquire_console_sem(); 2640 console_lock();
2641 unblank_screen(); 2641 unblank_screen();
2642 release_console_sem(); 2642 console_unlock();
2643 break; 2643 break;
2644 case TIOCL_SELLOADLUT: 2644 case TIOCL_SELLOADLUT:
2645 ret = sel_loadlut(p); 2645 ret = sel_loadlut(p);
@@ -2688,10 +2688,10 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
2688 } 2688 }
2689 break; 2689 break;
2690 case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */ 2690 case TIOCL_BLANKSCREEN: /* until explicitly unblanked, not only poked */
2691 acquire_console_sem(); 2691 console_lock();
2692 ignore_poke = 1; 2692 ignore_poke = 1;
2693 do_blank_screen(0); 2693 do_blank_screen(0);
2694 release_console_sem(); 2694 console_unlock();
2695 break; 2695 break;
2696 case TIOCL_BLANKEDSCREEN: 2696 case TIOCL_BLANKEDSCREEN:
2697 ret = console_blanked; 2697 ret = console_blanked;
@@ -2790,11 +2790,11 @@ static void con_flush_chars(struct tty_struct *tty)
2790 return; 2790 return;
2791 2791
2792 /* if we race with con_close(), vt may be null */ 2792 /* if we race with con_close(), vt may be null */
2793 acquire_console_sem(); 2793 console_lock();
2794 vc = tty->driver_data; 2794 vc = tty->driver_data;
2795 if (vc) 2795 if (vc)
2796 set_cursor(vc); 2796 set_cursor(vc);
2797 release_console_sem(); 2797 console_unlock();
2798} 2798}
2799 2799
2800/* 2800/*
@@ -2805,7 +2805,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2805 unsigned int currcons = tty->index; 2805 unsigned int currcons = tty->index;
2806 int ret = 0; 2806 int ret = 0;
2807 2807
2808 acquire_console_sem(); 2808 console_lock();
2809 if (tty->driver_data == NULL) { 2809 if (tty->driver_data == NULL) {
2810 ret = vc_allocate(currcons); 2810 ret = vc_allocate(currcons);
2811 if (ret == 0) { 2811 if (ret == 0) {
@@ -2813,7 +2813,7 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2813 2813
2814 /* Still being freed */ 2814 /* Still being freed */
2815 if (vc->port.tty) { 2815 if (vc->port.tty) {
2816 release_console_sem(); 2816 console_unlock();
2817 return -ERESTARTSYS; 2817 return -ERESTARTSYS;
2818 } 2818 }
2819 tty->driver_data = vc; 2819 tty->driver_data = vc;
@@ -2827,11 +2827,11 @@ static int con_open(struct tty_struct *tty, struct file *filp)
2827 tty->termios->c_iflag |= IUTF8; 2827 tty->termios->c_iflag |= IUTF8;
2828 else 2828 else
2829 tty->termios->c_iflag &= ~IUTF8; 2829 tty->termios->c_iflag &= ~IUTF8;
2830 release_console_sem(); 2830 console_unlock();
2831 return ret; 2831 return ret;
2832 } 2832 }
2833 } 2833 }
2834 release_console_sem(); 2834 console_unlock();
2835 return ret; 2835 return ret;
2836} 2836}
2837 2837
@@ -2844,9 +2844,9 @@ static void con_shutdown(struct tty_struct *tty)
2844{ 2844{
2845 struct vc_data *vc = tty->driver_data; 2845 struct vc_data *vc = tty->driver_data;
2846 BUG_ON(vc == NULL); 2846 BUG_ON(vc == NULL);
2847 acquire_console_sem(); 2847 console_lock();
2848 vc->port.tty = NULL; 2848 vc->port.tty = NULL;
2849 release_console_sem(); 2849 console_unlock();
2850 tty_shutdown(tty); 2850 tty_shutdown(tty);
2851} 2851}
2852 2852
@@ -2893,13 +2893,13 @@ static int __init con_init(void)
2893 struct vc_data *vc; 2893 struct vc_data *vc;
2894 unsigned int currcons = 0, i; 2894 unsigned int currcons = 0, i;
2895 2895
2896 acquire_console_sem(); 2896 console_lock();
2897 2897
2898 if (conswitchp) 2898 if (conswitchp)
2899 display_desc = conswitchp->con_startup(); 2899 display_desc = conswitchp->con_startup();
2900 if (!display_desc) { 2900 if (!display_desc) {
2901 fg_console = 0; 2901 fg_console = 0;
2902 release_console_sem(); 2902 console_unlock();
2903 return 0; 2903 return 0;
2904 } 2904 }
2905 2905
@@ -2946,7 +2946,7 @@ static int __init con_init(void)
2946 printable = 1; 2946 printable = 1;
2947 printk("\n"); 2947 printk("\n");
2948 2948
2949 release_console_sem(); 2949 console_unlock();
2950 2950
2951#ifdef CONFIG_VT_CONSOLE 2951#ifdef CONFIG_VT_CONSOLE
2952 register_console(&vt_console_driver); 2952 register_console(&vt_console_driver);
@@ -3037,7 +3037,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
3037 if (!try_module_get(owner)) 3037 if (!try_module_get(owner))
3038 return -ENODEV; 3038 return -ENODEV;
3039 3039
3040 acquire_console_sem(); 3040 console_lock();
3041 3041
3042 /* check if driver is registered */ 3042 /* check if driver is registered */
3043 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3043 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
@@ -3122,7 +3122,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
3122 3122
3123 retval = 0; 3123 retval = 0;
3124err: 3124err:
3125 release_console_sem(); 3125 console_unlock();
3126 module_put(owner); 3126 module_put(owner);
3127 return retval; 3127 return retval;
3128}; 3128};
@@ -3171,7 +3171,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
3171 if (!try_module_get(owner)) 3171 if (!try_module_get(owner))
3172 return -ENODEV; 3172 return -ENODEV;
3173 3173
3174 acquire_console_sem(); 3174 console_lock();
3175 3175
3176 /* check if driver is registered and if it is unbindable */ 3176 /* check if driver is registered and if it is unbindable */
3177 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3177 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
@@ -3185,7 +3185,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
3185 } 3185 }
3186 3186
3187 if (retval) { 3187 if (retval) {
3188 release_console_sem(); 3188 console_unlock();
3189 goto err; 3189 goto err;
3190 } 3190 }
3191 3191
@@ -3204,12 +3204,12 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
3204 } 3204 }
3205 3205
3206 if (retval) { 3206 if (retval) {
3207 release_console_sem(); 3207 console_unlock();
3208 goto err; 3208 goto err;
3209 } 3209 }
3210 3210
3211 if (!con_is_bound(csw)) { 3211 if (!con_is_bound(csw)) {
3212 release_console_sem(); 3212 console_unlock();
3213 goto err; 3213 goto err;
3214 } 3214 }
3215 3215
@@ -3238,7 +3238,7 @@ int unbind_con_driver(const struct consw *csw, int first, int last, int deflt)
3238 if (!con_is_bound(csw)) 3238 if (!con_is_bound(csw))
3239 con_driver->flag &= ~CON_DRIVER_FLAG_INIT; 3239 con_driver->flag &= ~CON_DRIVER_FLAG_INIT;
3240 3240
3241 release_console_sem(); 3241 console_unlock();
3242 /* ignore return value, binding should not fail */ 3242 /* ignore return value, binding should not fail */
3243 bind_con_driver(defcsw, first, last, deflt); 3243 bind_con_driver(defcsw, first, last, deflt);
3244err: 3244err:
@@ -3538,7 +3538,7 @@ int register_con_driver(const struct consw *csw, int first, int last)
3538 if (!try_module_get(owner)) 3538 if (!try_module_get(owner))
3539 return -ENODEV; 3539 return -ENODEV;
3540 3540
3541 acquire_console_sem(); 3541 console_lock();
3542 3542
3543 for (i = 0; i < MAX_NR_CON_DRIVER; i++) { 3543 for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
3544 con_driver = &registered_con_driver[i]; 3544 con_driver = &registered_con_driver[i];
@@ -3592,7 +3592,7 @@ int register_con_driver(const struct consw *csw, int first, int last)
3592 } 3592 }
3593 3593
3594err: 3594err:
3595 release_console_sem(); 3595 console_unlock();
3596 module_put(owner); 3596 module_put(owner);
3597 return retval; 3597 return retval;
3598} 3598}
@@ -3613,7 +3613,7 @@ int unregister_con_driver(const struct consw *csw)
3613{ 3613{
3614 int i, retval = -ENODEV; 3614 int i, retval = -ENODEV;
3615 3615
3616 acquire_console_sem(); 3616 console_lock();
3617 3617
3618 /* cannot unregister a bound driver */ 3618 /* cannot unregister a bound driver */
3619 if (con_is_bound(csw)) 3619 if (con_is_bound(csw))
@@ -3639,7 +3639,7 @@ int unregister_con_driver(const struct consw *csw)
3639 } 3639 }
3640 } 3640 }
3641err: 3641err:
3642 release_console_sem(); 3642 console_unlock();
3643 return retval; 3643 return retval;
3644} 3644}
3645EXPORT_SYMBOL(unregister_con_driver); 3645EXPORT_SYMBOL(unregister_con_driver);
@@ -3934,9 +3934,9 @@ int con_set_cmap(unsigned char __user *arg)
3934{ 3934{
3935 int rc; 3935 int rc;
3936 3936
3937 acquire_console_sem(); 3937 console_lock();
3938 rc = set_get_cmap (arg,1); 3938 rc = set_get_cmap (arg,1);
3939 release_console_sem(); 3939 console_unlock();
3940 3940
3941 return rc; 3941 return rc;
3942} 3942}
@@ -3945,9 +3945,9 @@ int con_get_cmap(unsigned char __user *arg)
3945{ 3945{
3946 int rc; 3946 int rc;
3947 3947
3948 acquire_console_sem(); 3948 console_lock();
3949 rc = set_get_cmap (arg,0); 3949 rc = set_get_cmap (arg,0);
3950 release_console_sem(); 3950 console_unlock();
3951 3951
3952 return rc; 3952 return rc;
3953} 3953}
@@ -3994,12 +3994,12 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op)
3994 } else 3994 } else
3995 font.data = NULL; 3995 font.data = NULL;
3996 3996
3997 acquire_console_sem(); 3997 console_lock();
3998 if (vc->vc_sw->con_font_get) 3998 if (vc->vc_sw->con_font_get)
3999 rc = vc->vc_sw->con_font_get(vc, &font); 3999 rc = vc->vc_sw->con_font_get(vc, &font);
4000 else 4000 else
4001 rc = -ENOSYS; 4001 rc = -ENOSYS;
4002 release_console_sem(); 4002 console_unlock();
4003 4003
4004 if (rc) 4004 if (rc)
4005 goto out; 4005 goto out;
@@ -4076,12 +4076,12 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op)
4076 font.data = memdup_user(op->data, size); 4076 font.data = memdup_user(op->data, size);
4077 if (IS_ERR(font.data)) 4077 if (IS_ERR(font.data))
4078 return PTR_ERR(font.data); 4078 return PTR_ERR(font.data);
4079 acquire_console_sem(); 4079 console_lock();
4080 if (vc->vc_sw->con_font_set) 4080 if (vc->vc_sw->con_font_set)
4081 rc = vc->vc_sw->con_font_set(vc, &font, op->flags); 4081 rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
4082 else 4082 else
4083 rc = -ENOSYS; 4083 rc = -ENOSYS;
4084 release_console_sem(); 4084 console_unlock();
4085 kfree(font.data); 4085 kfree(font.data);
4086 return rc; 4086 return rc;
4087} 4087}
@@ -4103,12 +4103,12 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op)
4103 else 4103 else
4104 name[MAX_FONT_NAME - 1] = 0; 4104 name[MAX_FONT_NAME - 1] = 0;
4105 4105
4106 acquire_console_sem(); 4106 console_lock();
4107 if (vc->vc_sw->con_font_default) 4107 if (vc->vc_sw->con_font_default)
4108 rc = vc->vc_sw->con_font_default(vc, &font, s); 4108 rc = vc->vc_sw->con_font_default(vc, &font, s);
4109 else 4109 else
4110 rc = -ENOSYS; 4110 rc = -ENOSYS;
4111 release_console_sem(); 4111 console_unlock();
4112 if (!rc) { 4112 if (!rc) {
4113 op->width = font.width; 4113 op->width = font.width;
4114 op->height = font.height; 4114 op->height = font.height;
@@ -4124,7 +4124,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
4124 if (vc->vc_mode != KD_TEXT) 4124 if (vc->vc_mode != KD_TEXT)
4125 return -EINVAL; 4125 return -EINVAL;
4126 4126
4127 acquire_console_sem(); 4127 console_lock();
4128 if (!vc->vc_sw->con_font_copy) 4128 if (!vc->vc_sw->con_font_copy)
4129 rc = -ENOSYS; 4129 rc = -ENOSYS;
4130 else if (con < 0 || !vc_cons_allocated(con)) 4130 else if (con < 0 || !vc_cons_allocated(con))
@@ -4133,7 +4133,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op)
4133 rc = 0; 4133 rc = 0;
4134 else 4134 else
4135 rc = vc->vc_sw->con_font_copy(vc, con); 4135 rc = vc->vc_sw->con_font_copy(vc, con);
4136 release_console_sem(); 4136 console_unlock();
4137 return rc; 4137 return rc;
4138} 4138}
4139 4139
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 6b68a0fb461..1235ebda6e1 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -649,12 +649,12 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
649 /* 649 /*
650 * explicitly blank/unblank the screen if switching modes 650 * explicitly blank/unblank the screen if switching modes
651 */ 651 */
652 acquire_console_sem(); 652 console_lock();
653 if (arg == KD_TEXT) 653 if (arg == KD_TEXT)
654 do_unblank_screen(1); 654 do_unblank_screen(1);
655 else 655 else
656 do_blank_screen(1); 656 do_blank_screen(1);
657 release_console_sem(); 657 console_unlock();
658 break; 658 break;
659 659
660 case KDGETMODE: 660 case KDGETMODE:
@@ -893,7 +893,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
893 ret = -EINVAL; 893 ret = -EINVAL;
894 goto out; 894 goto out;
895 } 895 }
896 acquire_console_sem(); 896 console_lock();
897 vc->vt_mode = tmp; 897 vc->vt_mode = tmp;
898 /* the frsig is ignored, so we set it to 0 */ 898 /* the frsig is ignored, so we set it to 0 */
899 vc->vt_mode.frsig = 0; 899 vc->vt_mode.frsig = 0;
@@ -901,7 +901,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
901 vc->vt_pid = get_pid(task_pid(current)); 901 vc->vt_pid = get_pid(task_pid(current));
902 /* no switch is required -- saw@shade.msu.ru */ 902 /* no switch is required -- saw@shade.msu.ru */
903 vc->vt_newvt = -1; 903 vc->vt_newvt = -1;
904 release_console_sem(); 904 console_unlock();
905 break; 905 break;
906 } 906 }
907 907
@@ -910,9 +910,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
910 struct vt_mode tmp; 910 struct vt_mode tmp;
911 int rc; 911 int rc;
912 912
913 acquire_console_sem(); 913 console_lock();
914 memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode)); 914 memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
915 release_console_sem(); 915 console_unlock();
916 916
917 rc = copy_to_user(up, &tmp, sizeof(struct vt_mode)); 917 rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
918 if (rc) 918 if (rc)
@@ -965,9 +965,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
965 ret = -ENXIO; 965 ret = -ENXIO;
966 else { 966 else {
967 arg--; 967 arg--;
968 acquire_console_sem(); 968 console_lock();
969 ret = vc_allocate(arg); 969 ret = vc_allocate(arg);
970 release_console_sem(); 970 console_unlock();
971 if (ret) 971 if (ret)
972 break; 972 break;
973 set_console(arg); 973 set_console(arg);
@@ -990,7 +990,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
990 ret = -ENXIO; 990 ret = -ENXIO;
991 else { 991 else {
992 vsa.console--; 992 vsa.console--;
993 acquire_console_sem(); 993 console_lock();
994 ret = vc_allocate(vsa.console); 994 ret = vc_allocate(vsa.console);
995 if (ret == 0) { 995 if (ret == 0) {
996 struct vc_data *nvc; 996 struct vc_data *nvc;
@@ -1003,7 +1003,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1003 put_pid(nvc->vt_pid); 1003 put_pid(nvc->vt_pid);
1004 nvc->vt_pid = get_pid(task_pid(current)); 1004 nvc->vt_pid = get_pid(task_pid(current));
1005 } 1005 }
1006 release_console_sem(); 1006 console_unlock();
1007 if (ret) 1007 if (ret)
1008 break; 1008 break;
1009 /* Commence switch and lock */ 1009 /* Commence switch and lock */
@@ -1044,7 +1044,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1044 /* 1044 /*
1045 * Switching-from response 1045 * Switching-from response
1046 */ 1046 */
1047 acquire_console_sem(); 1047 console_lock();
1048 if (vc->vt_newvt >= 0) { 1048 if (vc->vt_newvt >= 0) {
1049 if (arg == 0) 1049 if (arg == 0)
1050 /* 1050 /*
@@ -1063,7 +1063,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1063 vc->vt_newvt = -1; 1063 vc->vt_newvt = -1;
1064 ret = vc_allocate(newvt); 1064 ret = vc_allocate(newvt);
1065 if (ret) { 1065 if (ret) {
1066 release_console_sem(); 1066 console_unlock();
1067 break; 1067 break;
1068 } 1068 }
1069 /* 1069 /*
@@ -1083,7 +1083,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1083 if (arg != VT_ACKACQ) 1083 if (arg != VT_ACKACQ)
1084 ret = -EINVAL; 1084 ret = -EINVAL;
1085 } 1085 }
1086 release_console_sem(); 1086 console_unlock();
1087 break; 1087 break;
1088 1088
1089 /* 1089 /*
@@ -1096,20 +1096,20 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1096 } 1096 }
1097 if (arg == 0) { 1097 if (arg == 0) {
1098 /* deallocate all unused consoles, but leave 0 */ 1098 /* deallocate all unused consoles, but leave 0 */
1099 acquire_console_sem(); 1099 console_lock();
1100 for (i=1; i<MAX_NR_CONSOLES; i++) 1100 for (i=1; i<MAX_NR_CONSOLES; i++)
1101 if (! VT_BUSY(i)) 1101 if (! VT_BUSY(i))
1102 vc_deallocate(i); 1102 vc_deallocate(i);
1103 release_console_sem(); 1103 console_unlock();
1104 } else { 1104 } else {
1105 /* deallocate a single console, if possible */ 1105 /* deallocate a single console, if possible */
1106 arg--; 1106 arg--;
1107 if (VT_BUSY(arg)) 1107 if (VT_BUSY(arg))
1108 ret = -EBUSY; 1108 ret = -EBUSY;
1109 else if (arg) { /* leave 0 */ 1109 else if (arg) { /* leave 0 */
1110 acquire_console_sem(); 1110 console_lock();
1111 vc_deallocate(arg); 1111 vc_deallocate(arg);
1112 release_console_sem(); 1112 console_unlock();
1113 } 1113 }
1114 } 1114 }
1115 break; 1115 break;
@@ -1126,7 +1126,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1126 get_user(cc, &vtsizes->v_cols)) 1126 get_user(cc, &vtsizes->v_cols))
1127 ret = -EFAULT; 1127 ret = -EFAULT;
1128 else { 1128 else {
1129 acquire_console_sem(); 1129 console_lock();
1130 for (i = 0; i < MAX_NR_CONSOLES; i++) { 1130 for (i = 0; i < MAX_NR_CONSOLES; i++) {
1131 vc = vc_cons[i].d; 1131 vc = vc_cons[i].d;
1132 1132
@@ -1135,7 +1135,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1135 vc_resize(vc_cons[i].d, cc, ll); 1135 vc_resize(vc_cons[i].d, cc, ll);
1136 } 1136 }
1137 } 1137 }
1138 release_console_sem(); 1138 console_unlock();
1139 } 1139 }
1140 break; 1140 break;
1141 } 1141 }
@@ -1187,14 +1187,14 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
1187 for (i = 0; i < MAX_NR_CONSOLES; i++) { 1187 for (i = 0; i < MAX_NR_CONSOLES; i++) {
1188 if (!vc_cons[i].d) 1188 if (!vc_cons[i].d)
1189 continue; 1189 continue;
1190 acquire_console_sem(); 1190 console_lock();
1191 if (vlin) 1191 if (vlin)
1192 vc_cons[i].d->vc_scan_lines = vlin; 1192 vc_cons[i].d->vc_scan_lines = vlin;
1193 if (clin) 1193 if (clin)
1194 vc_cons[i].d->vc_font.height = clin; 1194 vc_cons[i].d->vc_font.height = clin;
1195 vc_cons[i].d->vc_resize_user = 1; 1195 vc_cons[i].d->vc_resize_user = 1;
1196 vc_resize(vc_cons[i].d, cc, ll); 1196 vc_resize(vc_cons[i].d, cc, ll);
1197 release_console_sem(); 1197 console_unlock();
1198 } 1198 }
1199 break; 1199 break;
1200 } 1200 }
@@ -1367,7 +1367,7 @@ void vc_SAK(struct work_struct *work)
1367 struct vc_data *vc; 1367 struct vc_data *vc;
1368 struct tty_struct *tty; 1368 struct tty_struct *tty;
1369 1369
1370 acquire_console_sem(); 1370 console_lock();
1371 vc = vc_con->d; 1371 vc = vc_con->d;
1372 if (vc) { 1372 if (vc) {
1373 tty = vc->port.tty; 1373 tty = vc->port.tty;
@@ -1379,7 +1379,7 @@ void vc_SAK(struct work_struct *work)
1379 __do_SAK(tty); 1379 __do_SAK(tty);
1380 reset_vc(vc); 1380 reset_vc(vc);
1381 } 1381 }
1382 release_console_sem(); 1382 console_unlock();
1383} 1383}
1384 1384
1385#ifdef CONFIG_COMPAT 1385#ifdef CONFIG_COMPAT
@@ -1737,10 +1737,10 @@ int vt_move_to_console(unsigned int vt, int alloc)
1737{ 1737{
1738 int prev; 1738 int prev;
1739 1739
1740 acquire_console_sem(); 1740 console_lock();
1741 /* Graphics mode - up to X */ 1741 /* Graphics mode - up to X */
1742 if (disable_vt_switch) { 1742 if (disable_vt_switch) {
1743 release_console_sem(); 1743 console_unlock();
1744 return 0; 1744 return 0;
1745 } 1745 }
1746 prev = fg_console; 1746 prev = fg_console;
@@ -1748,7 +1748,7 @@ int vt_move_to_console(unsigned int vt, int alloc)
1748 if (alloc && vc_allocate(vt)) { 1748 if (alloc && vc_allocate(vt)) {
1749 /* we can't have a free VC for now. Too bad, 1749 /* we can't have a free VC for now. Too bad,
1750 * we don't want to mess the screen for now. */ 1750 * we don't want to mess the screen for now. */
1751 release_console_sem(); 1751 console_unlock();
1752 return -ENOSPC; 1752 return -ENOSPC;
1753 } 1753 }
1754 1754
@@ -1758,10 +1758,10 @@ int vt_move_to_console(unsigned int vt, int alloc)
1758 * Let the calling function know so it can decide 1758 * Let the calling function know so it can decide
1759 * what to do. 1759 * what to do.
1760 */ 1760 */
1761 release_console_sem(); 1761 console_unlock();
1762 return -EIO; 1762 return -EIO;
1763 } 1763 }
1764 release_console_sem(); 1764 console_unlock();
1765 tty_lock(); 1765 tty_lock();
1766 if (vt_waitactive(vt + 1)) { 1766 if (vt_waitactive(vt + 1)) {
1767 pr_debug("Suspend: Can't switch VCs."); 1767 pr_debug("Suspend: Can't switch VCs.");
@@ -1781,8 +1781,8 @@ int vt_move_to_console(unsigned int vt, int alloc)
1781 */ 1781 */
1782void pm_set_vt_switch(int do_switch) 1782void pm_set_vt_switch(int do_switch)
1783{ 1783{
1784 acquire_console_sem(); 1784 console_lock();
1785 disable_vt_switch = !do_switch; 1785 disable_vt_switch = !do_switch;
1786 release_console_sem(); 1786 console_unlock();
1787} 1787}
1788EXPORT_SYMBOL(pm_set_vt_switch); 1788EXPORT_SYMBOL(pm_set_vt_switch);