diff options
-rw-r--r-- | drivers/char/tty_port.c | 11 | ||||
-rw-r--r-- | include/linux/tty.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index 926d4a5593fa..4d08b6d27c28 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
@@ -308,6 +308,17 @@ int tty_port_close_start(struct tty_port *port, struct tty_struct *tty, struct f | |||
308 | if (port->flags & ASYNC_INITIALIZED && | 308 | if (port->flags & ASYNC_INITIALIZED && |
309 | port->closing_wait != ASYNC_CLOSING_WAIT_NONE) | 309 | port->closing_wait != ASYNC_CLOSING_WAIT_NONE) |
310 | tty_wait_until_sent(tty, port->closing_wait); | 310 | tty_wait_until_sent(tty, port->closing_wait); |
311 | if (port->drain_delay) { | ||
312 | unsigned int bps = tty_get_baud_rate(tty); | ||
313 | long timeout; | ||
314 | |||
315 | if (bps > 1200) | ||
316 | timeout = max_t(long, (HZ * 10 * port->drain_delay) / bps, | ||
317 | HZ / 10); | ||
318 | else | ||
319 | timeout = 2 * HZ; | ||
320 | schedule_timeout_interruptible(timeout); | ||
321 | } | ||
311 | return 1; | 322 | return 1; |
312 | } | 323 | } |
313 | EXPORT_SYMBOL(tty_port_close_start); | 324 | EXPORT_SYMBOL(tty_port_close_start); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 98694364c96f..bed5a3d40307 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -201,6 +201,9 @@ struct tty_port { | |||
201 | unsigned char *xmit_buf; /* Optional buffer */ | 201 | unsigned char *xmit_buf; /* Optional buffer */ |
202 | int close_delay; /* Close port delay */ | 202 | int close_delay; /* Close port delay */ |
203 | int closing_wait; /* Delay for output */ | 203 | int closing_wait; /* Delay for output */ |
204 | int drain_delay; /* Set to zero if no pure time | ||
205 | based drain is needed else | ||
206 | set to size of fifo */ | ||
204 | }; | 207 | }; |
205 | 208 | ||
206 | /* | 209 | /* |