Cory T. Tusar db99247ac6 tty: fix logic change introduced by wait_event_interruptible_timeout()
Commit 5a52bd4a2dcb570333ce6fe2e16cd311650dbdc8 introduced a subtle logic
change in tty_wait_until_sent().  The original version would only error out
of the 'do { ...  } while (timeout)' loop if signal_pending() evaluated to
true; a timeout or break due to an empty buffer would fall out of the loop
and into the tty->driver->wait_until_sent handling.  The current
implementation will error out on either a pending signal or an empty
buffer, falling through to the tty->driver->wait_until_sent handling only
on a timeout.

The ->wait_until_sent() will not be reached if the buffer empties before
timeout jiffies have elapsed.  This behavior differs from that prior to commit
5a52bd4a2dcb570333ce6fe2e16cd311650dbdc8.

I turned this up while using a little serial download utility to bootstrap an
ARM-based eval board.  The util worked fine on 2.6.22.x, but consistently
failed on 2.6.23.x.  Once I'd determined that, I narrowed things down with git
bisect, and found the above difference in logic in tty_wait_until_sent() by
inspection.

This change reverts the logic flow in tty_wait_until_sent() to match that
prior to the aforementioned commit.

Signed-off-by: Cory T. Tusar <ctusar@videon-central.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Acked-by: Jiri Slaby <jirislaby@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-12-23 12:54:37 -08:00
..
2007-11-06 10:12:44 +10:00
2007-11-14 18:45:37 -08:00
2007-10-17 08:42:52 -07:00
2007-10-17 08:42:52 -07:00
2007-05-08 11:15:09 -07:00
2007-10-19 23:21:04 +02:00
2007-05-21 09:18:19 -07:00
2007-10-17 08:43:00 -07:00
2007-10-19 23:21:04 +02:00
2007-12-17 10:33:18 -08:00
2007-02-20 17:11:55 +00:00
2007-10-17 08:43:01 -07:00
2007-10-23 15:49:55 +10:00
2007-07-19 10:04:43 -07:00
2007-10-29 07:41:32 -07:00
2007-07-29 17:09:29 -07:00
2007-10-18 14:37:27 -07:00
2007-10-19 11:53:41 -07:00
2007-10-19 11:53:41 -07:00
2007-10-17 08:42:55 -07:00
2007-02-12 09:48:30 -08:00
2007-07-21 17:49:16 -07:00
2007-10-18 14:37:23 -07:00
2007-07-16 09:05:46 -07:00
2007-10-19 11:53:43 -07:00
2007-07-16 09:05:47 -07:00
2006-12-20 16:37:48 +11:00
2007-10-17 08:42:56 -07:00
2007-10-19 11:53:34 -07:00