Commit 5a52bd4a authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

Char: tty_ioctl, use wait_event_interruptible_timeout

tty_ioctl, use wait_event_interruptible_timeout
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2b770b4b
...@@ -52,8 +52,6 @@ ...@@ -52,8 +52,6 @@
void tty_wait_until_sent(struct tty_struct * tty, long timeout) void tty_wait_until_sent(struct tty_struct * tty, long timeout)
{ {
DECLARE_WAITQUEUE(wait, current);
#ifdef TTY_DEBUG_WAIT_UNTIL_SENT #ifdef TTY_DEBUG_WAIT_UNTIL_SENT
char buf[64]; char buf[64];
...@@ -61,26 +59,13 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout) ...@@ -61,26 +59,13 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout)
#endif #endif
if (!tty->driver->chars_in_buffer) if (!tty->driver->chars_in_buffer)
return; return;
add_wait_queue(&tty->write_wait, &wait);
if (!timeout) if (!timeout)
timeout = MAX_SCHEDULE_TIMEOUT; timeout = MAX_SCHEDULE_TIMEOUT;
do { if (wait_event_interruptible_timeout(tty->write_wait,
#ifdef TTY_DEBUG_WAIT_UNTIL_SENT !tty->driver->chars_in_buffer(tty), timeout))
printk(KERN_DEBUG "waiting %s...(%d)\n", tty_name(tty, buf), return;
tty->driver->chars_in_buffer(tty));
#endif
set_current_state(TASK_INTERRUPTIBLE);
if (signal_pending(current))
goto stop_waiting;
if (!tty->driver->chars_in_buffer(tty))
break;
timeout = schedule_timeout(timeout);
} while (timeout);
if (tty->driver->wait_until_sent) if (tty->driver->wait_until_sent)
tty->driver->wait_until_sent(tty, timeout); tty->driver->wait_until_sent(tty, timeout);
stop_waiting:
set_current_state(TASK_RUNNING);
remove_wait_queue(&tty->write_wait, &wait);
} }
EXPORT_SYMBOL(tty_wait_until_sent); EXPORT_SYMBOL(tty_wait_until_sent);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment