>From cea19eda592e61db780e3ce1a7bf9a5f0899a0fc Mon Sep 17 00:00:00 2001 From: Stas Sergeev Date: Sat, 18 May 2013 15:06:39 +0400 Subject: [PATCH] n_tty: fix .chars_in_buffer confusion n_tty_chars_in_buffer() was calculating the amount of input chars, not output chars. It therefore should not be used as a .chars_in_buffer member. This patch removes it from tty_ldisc_ops and renames to chars_in_input_buffer() Signed-off-by: Stas Sergeev --- drivers/tty/n_tty.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 3f228c9..0567235 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -253,7 +253,7 @@ static void n_tty_flush_buffer(struct tty_struct *tty) } /** - * n_tty_chars_in_buffer - report available bytes + * chars_in_input_buffer - report available bytes * @tty: tty device * * Report the number of characters buffered to be delivered to user @@ -262,7 +262,7 @@ static void n_tty_flush_buffer(struct tty_struct *tty) * Locking: read_lock */ -static ssize_t n_tty_chars_in_buffer(struct tty_struct *tty) +static ssize_t chars_in_input_buffer(struct tty_struct *tty) { struct n_tty_data *ldata = tty->disc_data; unsigned long flags; @@ -1977,7 +1977,7 @@ do_it_again: } /* If there is enough space in the read buffer now, let the - * low-level driver know. We use n_tty_chars_in_buffer() to + * low-level driver know. We use chars_in_input_buffer() to * check the buffer, as it now knows about canonical mode. * Otherwise, if the driver is throttled and the line is * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode, @@ -1985,7 +1985,7 @@ do_it_again: */ while (1) { tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE); - if (n_tty_chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE) + if (chars_in_input_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE) break; if (!tty->count) break; @@ -2206,7 +2206,6 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = { .open = n_tty_open, .close = n_tty_close, .flush_buffer = n_tty_flush_buffer, - .chars_in_buffer = n_tty_chars_in_buffer, .read = n_tty_read, .write = n_tty_write, .ioctl = n_tty_ioctl, -- 1.7.11.7