diff options
Diffstat (limited to 'drivers/tty/vt/vt.c')
-rw-r--r-- | drivers/tty/vt/vt.c | 135 |
1 files changed, 70 insertions, 65 deletions
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index 76407eca9ab0..147ede3423df 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 */ |
1275 | static void csi_m(struct vc_data *vc) | 1275 | static 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 */ |
1419 | static void set_mode(struct vc_data *vc, int on_off) | 1419 | static 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 */ |
1489 | static void setterm_command(struct vc_data *vc) | 1489 | static 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 */ |
1549 | static void csi_at(struct vc_data *vc, unsigned int nr) | 1549 | static 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 */ |
1559 | static void csi_L(struct vc_data *vc, unsigned int nr) | 1559 | static 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 */ |
1570 | static void csi_P(struct vc_data *vc, unsigned int nr) | 1570 | static 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 */ |
1580 | static void csi_M(struct vc_data *vc, unsigned int nr) | 1580 | static 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 */ |
1591 | static void save_cur(struct vc_data *vc) | 1591 | static 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 */ |
1607 | static void restore_cur(struct vc_data *vc) | 1607 | static 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()) */ |
1629 | static void reset_terminal(struct vc_data *vc, int do_clear) | 1629 | static 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 */ |
1689 | static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c) | 1689 | static 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 */ |
2123 | static int do_con_write(struct tty_struct *tty, const unsigned char *buf, int count) | 2123 | static 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 | */ |
2393 | static void console_callback(struct work_struct *ignored) | 2393 | static 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 | ||
2428 | int set_console(int nr) | 2428 | int 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); |
@@ -2994,7 +2994,7 @@ int __init vty_init(const struct file_operations *console_fops) | |||
2994 | if (IS_ERR(tty0dev)) | 2994 | if (IS_ERR(tty0dev)) |
2995 | tty0dev = NULL; | 2995 | tty0dev = NULL; |
2996 | else | 2996 | else |
2997 | device_create_file(tty0dev, &dev_attr_active); | 2997 | WARN_ON(device_create_file(tty0dev, &dev_attr_active) < 0); |
2998 | 2998 | ||
2999 | vcs_init(); | 2999 | vcs_init(); |
3000 | 3000 | ||
@@ -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; |
3124 | err: | 3124 | err: |
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); |
3244 | err: | 3244 | err: |
@@ -3538,14 +3538,14 @@ 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 = ®istered_con_driver[i]; | 3544 | con_driver = ®istered_con_driver[i]; |
3545 | 3545 | ||
3546 | /* already registered */ | 3546 | /* already registered */ |
3547 | if (con_driver->con == csw) | 3547 | if (con_driver->con == csw) |
3548 | retval = -EINVAL; | 3548 | retval = -EBUSY; |
3549 | } | 3549 | } |
3550 | 3550 | ||
3551 | if (retval) | 3551 | if (retval) |
@@ -3592,7 +3592,7 @@ int register_con_driver(const struct consw *csw, int first, int last) | |||
3592 | } | 3592 | } |
3593 | 3593 | ||
3594 | err: | 3594 | err: |
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 | } |
3641 | err: | 3641 | err: |
3642 | release_console_sem(); | 3642 | console_unlock(); |
3643 | return retval; | 3643 | return retval; |
3644 | } | 3644 | } |
3645 | EXPORT_SYMBOL(unregister_con_driver); | 3645 | EXPORT_SYMBOL(unregister_con_driver); |
@@ -3656,7 +3656,12 @@ int take_over_console(const struct consw *csw, int first, int last, int deflt) | |||
3656 | int err; | 3656 | int err; |
3657 | 3657 | ||
3658 | err = register_con_driver(csw, first, last); | 3658 | err = register_con_driver(csw, first, last); |
3659 | 3659 | /* if we get an busy error we still want to bind the console driver | |
3660 | * and return success, as we may have unbound the console driver | ||
3661 | * but not unregistered it. | ||
3662 | */ | ||
3663 | if (err == -EBUSY) | ||
3664 | err = 0; | ||
3660 | if (!err) | 3665 | if (!err) |
3661 | bind_con_driver(csw, first, last, deflt); | 3666 | bind_con_driver(csw, first, last, deflt); |
3662 | 3667 | ||
@@ -3934,9 +3939,9 @@ int con_set_cmap(unsigned char __user *arg) | |||
3934 | { | 3939 | { |
3935 | int rc; | 3940 | int rc; |
3936 | 3941 | ||
3937 | acquire_console_sem(); | 3942 | console_lock(); |
3938 | rc = set_get_cmap (arg,1); | 3943 | rc = set_get_cmap (arg,1); |
3939 | release_console_sem(); | 3944 | console_unlock(); |
3940 | 3945 | ||
3941 | return rc; | 3946 | return rc; |
3942 | } | 3947 | } |
@@ -3945,9 +3950,9 @@ int con_get_cmap(unsigned char __user *arg) | |||
3945 | { | 3950 | { |
3946 | int rc; | 3951 | int rc; |
3947 | 3952 | ||
3948 | acquire_console_sem(); | 3953 | console_lock(); |
3949 | rc = set_get_cmap (arg,0); | 3954 | rc = set_get_cmap (arg,0); |
3950 | release_console_sem(); | 3955 | console_unlock(); |
3951 | 3956 | ||
3952 | return rc; | 3957 | return rc; |
3953 | } | 3958 | } |
@@ -3994,12 +3999,12 @@ static int con_font_get(struct vc_data *vc, struct console_font_op *op) | |||
3994 | } else | 3999 | } else |
3995 | font.data = NULL; | 4000 | font.data = NULL; |
3996 | 4001 | ||
3997 | acquire_console_sem(); | 4002 | console_lock(); |
3998 | if (vc->vc_sw->con_font_get) | 4003 | if (vc->vc_sw->con_font_get) |
3999 | rc = vc->vc_sw->con_font_get(vc, &font); | 4004 | rc = vc->vc_sw->con_font_get(vc, &font); |
4000 | else | 4005 | else |
4001 | rc = -ENOSYS; | 4006 | rc = -ENOSYS; |
4002 | release_console_sem(); | 4007 | console_unlock(); |
4003 | 4008 | ||
4004 | if (rc) | 4009 | if (rc) |
4005 | goto out; | 4010 | goto out; |
@@ -4076,12 +4081,12 @@ static int con_font_set(struct vc_data *vc, struct console_font_op *op) | |||
4076 | font.data = memdup_user(op->data, size); | 4081 | font.data = memdup_user(op->data, size); |
4077 | if (IS_ERR(font.data)) | 4082 | if (IS_ERR(font.data)) |
4078 | return PTR_ERR(font.data); | 4083 | return PTR_ERR(font.data); |
4079 | acquire_console_sem(); | 4084 | console_lock(); |
4080 | if (vc->vc_sw->con_font_set) | 4085 | if (vc->vc_sw->con_font_set) |
4081 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); | 4086 | rc = vc->vc_sw->con_font_set(vc, &font, op->flags); |
4082 | else | 4087 | else |
4083 | rc = -ENOSYS; | 4088 | rc = -ENOSYS; |
4084 | release_console_sem(); | 4089 | console_unlock(); |
4085 | kfree(font.data); | 4090 | kfree(font.data); |
4086 | return rc; | 4091 | return rc; |
4087 | } | 4092 | } |
@@ -4103,12 +4108,12 @@ static int con_font_default(struct vc_data *vc, struct console_font_op *op) | |||
4103 | else | 4108 | else |
4104 | name[MAX_FONT_NAME - 1] = 0; | 4109 | name[MAX_FONT_NAME - 1] = 0; |
4105 | 4110 | ||
4106 | acquire_console_sem(); | 4111 | console_lock(); |
4107 | if (vc->vc_sw->con_font_default) | 4112 | if (vc->vc_sw->con_font_default) |
4108 | rc = vc->vc_sw->con_font_default(vc, &font, s); | 4113 | rc = vc->vc_sw->con_font_default(vc, &font, s); |
4109 | else | 4114 | else |
4110 | rc = -ENOSYS; | 4115 | rc = -ENOSYS; |
4111 | release_console_sem(); | 4116 | console_unlock(); |
4112 | if (!rc) { | 4117 | if (!rc) { |
4113 | op->width = font.width; | 4118 | op->width = font.width; |
4114 | op->height = font.height; | 4119 | op->height = font.height; |
@@ -4124,7 +4129,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4124 | if (vc->vc_mode != KD_TEXT) | 4129 | if (vc->vc_mode != KD_TEXT) |
4125 | return -EINVAL; | 4130 | return -EINVAL; |
4126 | 4131 | ||
4127 | acquire_console_sem(); | 4132 | console_lock(); |
4128 | if (!vc->vc_sw->con_font_copy) | 4133 | if (!vc->vc_sw->con_font_copy) |
4129 | rc = -ENOSYS; | 4134 | rc = -ENOSYS; |
4130 | else if (con < 0 || !vc_cons_allocated(con)) | 4135 | else if (con < 0 || !vc_cons_allocated(con)) |
@@ -4133,7 +4138,7 @@ static int con_font_copy(struct vc_data *vc, struct console_font_op *op) | |||
4133 | rc = 0; | 4138 | rc = 0; |
4134 | else | 4139 | else |
4135 | rc = vc->vc_sw->con_font_copy(vc, con); | 4140 | rc = vc->vc_sw->con_font_copy(vc, con); |
4136 | release_console_sem(); | 4141 | console_unlock(); |
4137 | return rc; | 4142 | return rc; |
4138 | } | 4143 | } |
4139 | 4144 | ||