diff options
author | Alex Shi <alex.shi@linaro.org> | 2017-10-04 12:03:49 +0800 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2017-10-04 12:03:49 +0800 |
commit | a38b2dd146c0bba28633fe857f0c4626e0c691cc (patch) | |
tree | 2d81121c3690a36a3679bc78552067eee74c2c81 /drivers/tty/tty_buffer.c | |
parent | 7ecc9777c5c76d7b31c376ffd4f59c4a85472a1b (diff) | |
parent | d59dabdc4cb380b79c965af28cd4ba001f04834b (diff) |
Merge tag 'v4.9.52' into linux-linaro-lsk-v4.9lsk-v4.9-17.09
This is the 4.9.52 stable release
Diffstat (limited to 'drivers/tty/tty_buffer.c')
-rw-r--r-- | drivers/tty/tty_buffer.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c index aa80dc94ddc2..c220c2c0893f 100644 --- a/drivers/tty/tty_buffer.c +++ b/drivers/tty/tty_buffer.c @@ -362,6 +362,32 @@ int tty_insert_flip_string_flags(struct tty_port *port, EXPORT_SYMBOL(tty_insert_flip_string_flags); /** + * __tty_insert_flip_char - Add one character to the tty buffer + * @port: tty port + * @ch: character + * @flag: flag byte + * + * Queue a single byte to the tty buffering, with an optional flag. + * This is the slow path of tty_insert_flip_char. + */ +int __tty_insert_flip_char(struct tty_port *port, unsigned char ch, char flag) +{ + struct tty_buffer *tb; + int flags = (flag == TTY_NORMAL) ? TTYB_NORMAL : 0; + + if (!__tty_buffer_request_room(port, 1, flags)) + return 0; + + tb = port->buf.tail; + if (~tb->flags & TTYB_NORMAL) + *flag_buf_ptr(tb, tb->used) = flag; + *char_buf_ptr(tb, tb->used++) = ch; + + return 1; +} +EXPORT_SYMBOL(__tty_insert_flip_char); + +/** * tty_schedule_flip - push characters to ldisc * @port: tty port to push from * |