]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit2ce8f96362b3cf808ac47ca0024b47671a771389
tree829f2d3cd05150f399b89460b1796afb64f9770d
parent872975e981da3ce1a3fb4ea4fe75a90d759ee1a4
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