diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-04-14 22:28:32 +0100 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2015-04-14 22:28:32 +0100 |
| commit | 4b2f8838479eb2abe042e094f7d2cced6d5ea772 (patch) | |
| tree | 5ef3236b354a494c8d71a572896283e44989c696 /drivers/tty/tty_ioctl.c | |
| parent | c848791f0336914a3081ea3fe029cf177d81de81 (diff) | |
| parent | 9fd85eb502a78bd812db58bd1f668b2a06ee30a5 (diff) | |
Merge branch 'devel-stable' into for-next
Diffstat (limited to 'drivers/tty/tty_ioctl.c')
| -rw-r--r-- | drivers/tty/tty_ioctl.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c index a5cf253b2544..632fc8152061 100644 --- a/drivers/tty/tty_ioctl.c +++ b/drivers/tty/tty_ioctl.c @@ -217,11 +217,17 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout) #endif if (!timeout) timeout = MAX_SCHEDULE_TIMEOUT; - if (wait_event_interruptible_timeout(tty->write_wait, - !tty_chars_in_buffer(tty), timeout) >= 0) { - if (tty->ops->wait_until_sent) - tty->ops->wait_until_sent(tty, timeout); - } + + timeout = wait_event_interruptible_timeout(tty->write_wait, + !tty_chars_in_buffer(tty), timeout); + if (timeout <= 0) + return; + + if (timeout == MAX_SCHEDULE_TIMEOUT) + timeout = 0; + + if (tty->ops->wait_until_sent) + tty->ops->wait_until_sent(tty, timeout); } EXPORT_SYMBOL(tty_wait_until_sent); |
