summary refs log tree commit diff
path: root/drivers/tty/tty_ioctl.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-03-26 17:50:42 -0700
committerMark Brown <broonie@kernel.org>2015-03-26 17:50:42 -0700
commit1be38e041f8eaa935f370aa0f34dd7a2fe39b1d8 (patch)
tree2d89734fc831593784bd411be03a1b9649de4c9d /drivers/tty/tty_ioctl.c
parent6935224da2482a261c786501fbccb1dc4a675225 (diff)
parentbc465aa9d045feb0e13b4a8f32cc33c1943f62d6 (diff)
downloadlinux-1be38e041f8eaa935f370aa0f34dd7a2fe39b1d8.tar.gz
Merge tag 'v4.0-rc5' into spi-bcm2835
Linux 4.0-rc5
Diffstat (limited to 'drivers/tty/tty_ioctl.c')
-rw-r--r--drivers/tty/tty_ioctl.c16
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);