]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/tty/tty_buffer.c
Merge tag 'rproc-v4.14' of git://github.com/andersson/remoteproc
[mirror_ubuntu-bionic-kernel.git] / drivers / tty / tty_buffer.c
index 4e7a4e9dcf4d3740b7c4655c37ec54d9ff93b76c..f8eba1c5412f9518a2c30bb3cf6ae365c8d9fbb1 100644 (file)
@@ -361,6 +361,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