diff options
Diffstat (limited to 'drivers/char')
| -rw-r--r-- | drivers/char/n_tty.c | 3 | ||||
| -rw-r--r-- | drivers/char/pty.c | 10 | ||||
| -rw-r--r-- | drivers/char/tty_ldisc.c | 10 |
3 files changed, 9 insertions, 14 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 973be2f44195..4e28b35024ec 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
| @@ -300,8 +300,7 @@ static int do_output_char(unsigned char c, struct tty_struct *tty, int space) | |||
| 300 | if (space < 2) | 300 | if (space < 2) |
| 301 | return -1; | 301 | return -1; |
| 302 | tty->canon_column = tty->column = 0; | 302 | tty->canon_column = tty->column = 0; |
| 303 | tty_put_char(tty, '\r'); | 303 | tty->ops->write(tty, "\r\n", 2); |
| 304 | tty_put_char(tty, c); | ||
| 305 | return 2; | 304 | return 2; |
| 306 | } | 305 | } |
| 307 | tty->canon_column = tty->column; | 306 | tty->canon_column = tty->column; |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index d083c73d784a..b33d6688e910 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
| @@ -109,21 +109,13 @@ static int pty_space(struct tty_struct *to) | |||
| 109 | * the other side of the pty/tty pair. | 109 | * the other side of the pty/tty pair. |
| 110 | */ | 110 | */ |
| 111 | 111 | ||
| 112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, | 112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c) |
| 113 | int count) | ||
| 114 | { | 113 | { |
| 115 | struct tty_struct *to = tty->link; | 114 | struct tty_struct *to = tty->link; |
| 116 | int c; | ||
| 117 | 115 | ||
| 118 | if (tty->stopped) | 116 | if (tty->stopped) |
| 119 | return 0; | 117 | return 0; |
| 120 | 118 | ||
| 121 | /* This isn't locked but our 8K is quite sloppy so no | ||
| 122 | big deal */ | ||
| 123 | |||
| 124 | c = pty_space(to); | ||
| 125 | if (c > count) | ||
| 126 | c = count; | ||
| 127 | if (c > 0) { | 119 | if (c > 0) { |
| 128 | /* Stuff the data into the input queue of the other end */ | 120 | /* Stuff the data into the input queue of the other end */ |
| 129 | c = tty_insert_flip_string(to, buf, c); | 121 | c = tty_insert_flip_string(to, buf, c); |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 1733d3439ad2..e48af9f79219 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
| @@ -508,8 +508,9 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old) | |||
| 508 | * be obtained while the delayed work queue halt ensures that no more | 508 | * be obtained while the delayed work queue halt ensures that no more |
| 509 | * data is fed to the ldisc. | 509 | * data is fed to the ldisc. |
| 510 | * | 510 | * |
| 511 | * In order to wait for any existing references to complete see | 511 | * You need to do a 'flush_scheduled_work()' (outside the ldisc_mutex) |
| 512 | * tty_ldisc_wait_idle. | 512 | * in order to make sure any currently executing ldisc work is also |
| 513 | * flushed. | ||
| 513 | */ | 514 | */ |
| 514 | 515 | ||
| 515 | static int tty_ldisc_halt(struct tty_struct *tty) | 516 | static int tty_ldisc_halt(struct tty_struct *tty) |
| @@ -753,11 +754,14 @@ void tty_ldisc_hangup(struct tty_struct *tty) | |||
| 753 | * N_TTY. | 754 | * N_TTY. |
| 754 | */ | 755 | */ |
| 755 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { | 756 | if (tty->driver->flags & TTY_DRIVER_RESET_TERMIOS) { |
| 757 | /* Make sure the old ldisc is quiescent */ | ||
| 758 | tty_ldisc_halt(tty); | ||
| 759 | flush_scheduled_work(); | ||
| 760 | |||
| 756 | /* Avoid racing set_ldisc or tty_ldisc_release */ | 761 | /* Avoid racing set_ldisc or tty_ldisc_release */ |
| 757 | mutex_lock(&tty->ldisc_mutex); | 762 | mutex_lock(&tty->ldisc_mutex); |
| 758 | if (tty->ldisc) { /* Not yet closed */ | 763 | if (tty->ldisc) { /* Not yet closed */ |
| 759 | /* Switch back to N_TTY */ | 764 | /* Switch back to N_TTY */ |
| 760 | tty_ldisc_halt(tty); | ||
| 761 | tty_ldisc_reinit(tty); | 765 | tty_ldisc_reinit(tty); |
| 762 | /* At this point we have a closed ldisc and we want to | 766 | /* At this point we have a closed ldisc and we want to |
| 763 | reopen it. We could defer this to the next open but | 767 | reopen it. We could defer this to the next open but |
