aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/n_tty.c3
-rw-r--r--drivers/char/nozomi.c12
-rw-r--r--drivers/char/tty_ldisc.c25
-rw-r--r--drivers/char/tty_port.c2
-rw-r--r--drivers/char/vt.c12
5 files changed, 27 insertions, 27 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index 94a5d5020abc..ff47907ff1bf 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1331,9 +1331,6 @@ handle_newline:
1331 1331
1332static void n_tty_write_wakeup(struct tty_struct *tty) 1332static void n_tty_write_wakeup(struct tty_struct *tty)
1333{ 1333{
1334 /* Write out any echoed characters that are still pending */
1335 process_echoes(tty);
1336
1337 if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) 1334 if (tty->fasync && test_and_clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags))
1338 kill_fasync(&tty->fasync, SIGIO, POLL_OUT); 1335 kill_fasync(&tty->fasync, SIGIO, POLL_OUT);
1339} 1336}
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 574f1c79b6e6..280b41c507a7 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -828,7 +828,7 @@ static int receive_data(enum port_type index, struct nozomi *dc)
828 struct port *port = &dc->port[index]; 828 struct port *port = &dc->port[index];
829 void __iomem *addr = port->dl_addr[port->toggle_dl]; 829 void __iomem *addr = port->dl_addr[port->toggle_dl];
830 struct tty_struct *tty = tty_port_tty_get(&port->port); 830 struct tty_struct *tty = tty_port_tty_get(&port->port);
831 int i; 831 int i, ret;
832 832
833 if (unlikely(!tty)) { 833 if (unlikely(!tty)) {
834 DBG1("tty not open for port: %d?", index); 834 DBG1("tty not open for port: %d?", index);
@@ -844,12 +844,14 @@ static int receive_data(enum port_type index, struct nozomi *dc)
844 844
845 /* disable interrupt in downlink... */ 845 /* disable interrupt in downlink... */
846 disable_transmit_dl(index, dc); 846 disable_transmit_dl(index, dc);
847 return 0; 847 ret = 0;
848 goto put;
848 } 849 }
849 850
850 if (unlikely(size == 0)) { 851 if (unlikely(size == 0)) {
851 dev_err(&dc->pdev->dev, "size == 0?\n"); 852 dev_err(&dc->pdev->dev, "size == 0?\n");
852 return 1; 853 ret = 1;
854 goto put;
853 } 855 }
854 856
855 tty_buffer_request_room(tty, size); 857 tty_buffer_request_room(tty, size);
@@ -871,8 +873,10 @@ static int receive_data(enum port_type index, struct nozomi *dc)
871 } 873 }
872 874
873 set_bit(index, &dc->flip); 875 set_bit(index, &dc->flip);
876 ret = 1;
877put:
874 tty_kref_put(tty); 878 tty_kref_put(tty);
875 return 1; 879 return ret;
876} 880}
877 881
878/* Debug for interrupts */ 882/* Debug for interrupts */
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c
index 0ef0dc97ba20..acd76b767d4c 100644
--- a/drivers/char/tty_ldisc.c
+++ b/drivers/char/tty_ldisc.c
@@ -790,17 +790,20 @@ void tty_ldisc_hangup(struct tty_struct *tty)
790 * N_TTY. 790 * N_TTY.
791 */ 791 */
792 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { 792 if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) {
793 /* Avoid racing set_ldisc */ 793 /* Avoid racing set_ldisc or tty_ldisc_release */
794 mutex_lock(&tty->ldisc_mutex); 794 mutex_lock(&tty->ldisc_mutex);
795 /* Switch back to N_TTY */ 795 if (tty->ldisc) { /* Not yet closed */
796 tty_ldisc_halt(tty); 796 /* Switch back to N_TTY */
797 tty_ldisc_wait_idle(tty); 797 tty_ldisc_halt(tty);
798 tty_ldisc_reinit(tty); 798 tty_ldisc_wait_idle(tty);
799 /* At this point we have a closed ldisc and we want to 799 tty_ldisc_reinit(tty);
800 reopen it. We could defer this to the next open but 800 /* At this point we have a closed ldisc and we want to
801 it means auditing a lot of other paths so this is a FIXME */ 801 reopen it. We could defer this to the next open but
802 WARN_ON(tty_ldisc_open(tty, tty->ldisc)); 802 it means auditing a lot of other paths so this is
803 tty_ldisc_enable(tty); 803 a FIXME */
804 WARN_ON(tty_ldisc_open(tty, tty->ldisc));
805 tty_ldisc_enable(tty);
806 }
804 mutex_unlock(&tty->ldisc_mutex); 807 mutex_unlock(&tty->ldisc_mutex);
805 tty_reset_termios(tty); 808 tty_reset_termios(tty);
806 } 809 }
@@ -865,6 +868,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
865 868
866 tty_ldisc_wait_idle(tty); 869 tty_ldisc_wait_idle(tty);
867 870
871 mutex_lock(&tty->ldisc_mutex);
868 /* 872 /*
869 * Now kill off the ldisc 873 * Now kill off the ldisc
870 */ 874 */
@@ -875,6 +879,7 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
875 879
876 /* Ensure the next open requests the N_TTY ldisc */ 880 /* Ensure the next open requests the N_TTY ldisc */
877 tty_set_termios_ldisc(tty, N_TTY); 881 tty_set_termios_ldisc(tty, N_TTY);
882 mutex_unlock(&tty->ldisc_mutex);
878 883
879 /* This will need doing differently if we need to lock */ 884 /* This will need doing differently if we need to lock */
880 if (o_tty) 885 if (o_tty)
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c
index 4e862a75f7ff..9769b1149f76 100644
--- a/drivers/char/tty_port.c
+++ b/drivers/char/tty_port.c
@@ -267,7 +267,7 @@ int tty_port_block_til_ready(struct tty_port *port,
267 if (retval == 0) 267 if (retval == 0)
268 port->flags |= ASYNC_NORMAL_ACTIVE; 268 port->flags |= ASYNC_NORMAL_ACTIVE;
269 spin_unlock_irqrestore(&port->lock, flags); 269 spin_unlock_irqrestore(&port->lock, flags);
270 return 0; 270 return retval;
271 271
272} 272}
273EXPORT_SYMBOL(tty_port_block_til_ready); 273EXPORT_SYMBOL(tty_port_block_til_ready);
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 7947bd1b4cf7..404f4c1ee431 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -770,14 +770,12 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */
770 visual_init(vc, currcons, 1); 770 visual_init(vc, currcons, 1);
771 if (!*vc->vc_uni_pagedir_loc) 771 if (!*vc->vc_uni_pagedir_loc)
772 con_set_default_unimap(vc); 772 con_set_default_unimap(vc);
773 if (!vc->vc_kmalloced) 773 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
774 vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
775 if (!vc->vc_screenbuf) { 774 if (!vc->vc_screenbuf) {
776 kfree(vc); 775 kfree(vc);
777 vc_cons[currcons].d = NULL; 776 vc_cons[currcons].d = NULL;
778 return -ENOMEM; 777 return -ENOMEM;
779 } 778 }
780 vc->vc_kmalloced = 1;
781 vc_init(vc, vc->vc_rows, vc->vc_cols, 1); 779 vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
782 vcs_make_sysfs(currcons); 780 vcs_make_sysfs(currcons);
783 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param); 781 atomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);
@@ -913,10 +911,8 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
913 if (new_scr_end > new_origin) 911 if (new_scr_end > new_origin)
914 scr_memsetw((void *)new_origin, vc->vc_video_erase_char, 912 scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
915 new_scr_end - new_origin); 913 new_scr_end - new_origin);
916 if (vc->vc_kmalloced) 914 kfree(vc->vc_screenbuf);
917 kfree(vc->vc_screenbuf);
918 vc->vc_screenbuf = newscreen; 915 vc->vc_screenbuf = newscreen;
919 vc->vc_kmalloced = 1;
920 vc->vc_screenbuf_size = new_screen_size; 916 vc->vc_screenbuf_size = new_screen_size;
921 set_origin(vc); 917 set_origin(vc);
922 918
@@ -995,8 +991,7 @@ void vc_deallocate(unsigned int currcons)
995 vc->vc_sw->con_deinit(vc); 991 vc->vc_sw->con_deinit(vc);
996 put_pid(vc->vt_pid); 992 put_pid(vc->vt_pid);
997 module_put(vc->vc_sw->owner); 993 module_put(vc->vc_sw->owner);
998 if (vc->vc_kmalloced) 994 kfree(vc->vc_screenbuf);
999 kfree(vc->vc_screenbuf);
1000 if (currcons >= MIN_NR_CONSOLES) 995 if (currcons >= MIN_NR_CONSOLES)
1001 kfree(vc); 996 kfree(vc);
1002 vc_cons[currcons].d = NULL; 997 vc_cons[currcons].d = NULL;
@@ -2881,7 +2876,6 @@ static int __init con_init(void)
2881 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK); 2876 INIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);
2882 visual_init(vc, currcons, 1); 2877 visual_init(vc, currcons, 1);
2883 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT); 2878 vc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_NOWAIT);
2884 vc->vc_kmalloced = 0;
2885 vc_init(vc, vc->vc_rows, vc->vc_cols, 2879 vc_init(vc, vc->vc_rows, vc->vc_cols,
2886 currcons || !vc->vc_sw->con_save_screen); 2880 currcons || !vc->vc_sw->con_save_screen);
2887 } 2881 }