Commit:     db99247ac68fc352100090ad7704fb5efb9327b6
Parent:     870e6f7e15980d1a33615de572078406737ac22e
Author:     Cory T. Tusar <[EMAIL PROTECTED]>
AuthorDate: Sun Dec 23 12:34:51 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun Dec 23 12:54:37 2007 -0800

    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 
    I turned this up while using a little serial download utility to bootstrap 
    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 
    bisect, and found the above difference in logic in tty_wait_until_sent() by
    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 <[EMAIL PROTECTED]>
    Cc: Alan Cox <[EMAIL PROTECTED]>
    Acked-by: Jiri Slaby <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/char/tty_ioctl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c
index 1bdd2bf..e02d592 100644
--- a/drivers/char/tty_ioctl.c
+++ b/drivers/char/tty_ioctl.c
@@ -62,7 +62,7 @@ void tty_wait_until_sent(struct tty_struct * tty, long 
        if (!timeout)
                timeout = MAX_SCHEDULE_TIMEOUT;
        if (wait_event_interruptible_timeout(tty->write_wait,
-                       !tty->driver->chars_in_buffer(tty), timeout))
+                       !tty->driver->chars_in_buffer(tty), timeout) < 0)
        if (tty->driver->wait_until_sent)
                tty->driver->wait_until_sent(tty, timeout);
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to