提交 9a4aec2d 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

n_tty: Move chars_in_buffer() to factor throttle/unthrottle

Prepare to factor throttle and unthrottle into helper functions;
relocate chars_in_buffer() to avoid forward declaration.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 d8c1f929
......@@ -202,6 +202,18 @@ static void n_tty_set_room(struct tty_struct *tty)
}
}
static ssize_t chars_in_buffer(struct tty_struct *tty)
{
struct n_tty_data *ldata = tty->disc_data;
ssize_t n = 0;
if (!ldata->icanon)
n = read_cnt(ldata);
else
n = ldata->canon_head - ldata->read_tail;
return n;
}
/**
* put_tty_queue - add character to tty
* @c: character
......@@ -285,18 +297,6 @@ static void n_tty_flush_buffer(struct tty_struct *tty)
up_write(&tty->termios_rwsem);
}
static ssize_t chars_in_buffer(struct tty_struct *tty)
{
struct n_tty_data *ldata = tty->disc_data;
ssize_t n = 0;
if (!ldata->icanon)
n = read_cnt(ldata);
else
n = ldata->canon_head - ldata->read_tail;
return n;
}
/**
* n_tty_chars_in_buffer - report available bytes
* @tty: tty device
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册