diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-07-16 02:40:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:43 -0400 |
commit | 5a52bd4a2dcb570333ce6fe2e16cd311650dbdc8 (patch) | |
tree | fafae698d93cb5d03cb110f5f8b8f39596eaad40 /drivers/char/tty_ioctl.c | |
parent | 2b770b4b29c741bbcbb77d2618955897765a81bf (diff) |
Char: tty_ioctl, use wait_event_interruptible_timeout
tty_ioctl, use wait_event_interruptible_timeout
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/tty_ioctl.c')
-rw-r--r-- | drivers/char/tty_ioctl.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 918e24c885f1..2b6a3847a9ee 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -52,8 +52,6 @@ | |||
52 | 52 | ||
53 | void tty_wait_until_sent(struct tty_struct * tty, long timeout) | 53 | void tty_wait_until_sent(struct tty_struct * tty, long timeout) |
54 | { | 54 | { |
55 | DECLARE_WAITQUEUE(wait, current); | ||
56 | |||
57 | #ifdef TTY_DEBUG_WAIT_UNTIL_SENT | 55 | #ifdef TTY_DEBUG_WAIT_UNTIL_SENT |
58 | char buf[64]; | 56 | char buf[64]; |
59 | 57 | ||
@@ -61,26 +59,13 @@ void tty_wait_until_sent(struct tty_struct * tty, long timeout) | |||
61 | #endif | 59 | #endif |
62 | if (!tty->driver->chars_in_buffer) | 60 | if (!tty->driver->chars_in_buffer) |
63 | return; | 61 | return; |
64 | add_wait_queue(&tty->write_wait, &wait); | ||
65 | if (!timeout) | 62 | if (!timeout) |
66 | timeout = MAX_SCHEDULE_TIMEOUT; | 63 | timeout = MAX_SCHEDULE_TIMEOUT; |
67 | do { | 64 | if (wait_event_interruptible_timeout(tty->write_wait, |
68 | #ifdef TTY_DEBUG_WAIT_UNTIL_SENT | 65 | !tty->driver->chars_in_buffer(tty), timeout)) |
69 | printk(KERN_DEBUG "waiting %s...(%d)\n", tty_name(tty, buf), | 66 | return; |
70 | tty->driver->chars_in_buffer(tty)); | ||
71 | #endif | ||
72 | set_current_state(TASK_INTERRUPTIBLE); | ||
73 | if (signal_pending(current)) | ||
74 | goto stop_waiting; | ||
75 | if (!tty->driver->chars_in_buffer(tty)) | ||
76 | break; | ||
77 | timeout = schedule_timeout(timeout); | ||
78 | } while (timeout); | ||
79 | if (tty->driver->wait_until_sent) | 67 | if (tty->driver->wait_until_sent) |
80 | tty->driver->wait_until_sent(tty, timeout); | 68 | tty->driver->wait_until_sent(tty, timeout); |
81 | stop_waiting: | ||
82 | set_current_state(TASK_RUNNING); | ||
83 | remove_wait_queue(&tty->write_wait, &wait); | ||
84 | } | 69 | } |
85 | 70 | ||
86 | EXPORT_SYMBOL(tty_wait_until_sent); | 71 | EXPORT_SYMBOL(tty_wait_until_sent); |