aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tty_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tty_ioctl.c')
-rw-r--r--drivers/char/tty_ioctl.c21
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
53void tty_wait_until_sent(struct tty_struct * tty, long timeout) 53void 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);
81stop_waiting:
82 set_current_state(TASK_RUNNING);
83 remove_wait_queue(&tty->write_wait, &wait);
84} 69}
85 70
86EXPORT_SYMBOL(tty_wait_until_sent); 71EXPORT_SYMBOL(tty_wait_until_sent);