tty: Simplify tty buffer/ldisc interface with helper function
authorPeter Hurley <peter@hurleysoftware.com>
Sat, 15 Jun 2013 13:14:14 +0000 (09:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Jul 2013 23:42:59 +0000 (16:42 -0700)
commitda261e7fe7b0e23a0d4d46039d20dc60fa197b49
tree829f2d3cd05150f399b89460b1796afb64f9770d
parent3b80df7ca7e2fec76be2eda304cc7e0eb90f911d
tty: Simplify tty buffer/ldisc interface with helper function

Ldisc interface functions must be called with interrupts enabled.
Separating the ldisc calls into a helper function simplies the
eventual removal of the spinlock.

Note that access to the buf->head ptr outside the spinlock is
safe here because;
* __tty_buffer_flush() is prevented from running while buffer work
  performs i/o,
* tty_buffer_find() only assigns buf->head if the flip buffer list
  is empty (which is never the case in flush_to_ldisc() since at
  least one buffer is always left in the list after use)
Access to the read index outside the spinlock is safe here for the
same reasons.

Update the buffer's read index _after_ the data has been received
by the ldisc.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_buffer.c