From 9a6ab2652f54fba7d10a755272da32075f7190ca Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 11 Jun 2009 12:25:25 +0100 Subject: [PATCH] --- yaml --- r: 146239 b: refs/heads/master c: 1ec739be75a6cb961a46ba0b1982d0edb7f27558 h: refs/heads/master i: 146237: c567496c7d9705de187c70d1efc034babdceb142 146235: 1759308df5dc1e9c6710446d959cdefd5e120f68 146231: 5b2f8f4ca64387b59b97488363f328d8799b9a11 146223: 4de21a4bdd32a4833180703cb4ad33a3e7a411f1 146207: 8d60fc41af79dae8afc91c4a40224a935116f875 146175: 16d1fe19991aec8a7ab16eae8e85b280c646624c v: v3 --- [refs] | 2 +- trunk/drivers/char/tty_port.c | 11 +++++++++++ trunk/include/linux/tty.h | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index d50e567e6f0b..822add77d80a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fcc8ac1825d3d0fb81f73bc1a80ebc863168bb56 +refs/heads/master: 1ec739be75a6cb961a46ba0b1982d0edb7f27558 diff --git a/trunk/drivers/char/tty_port.c b/trunk/drivers/char/tty_port.c index 926d4a5593fa..4d08b6d27c28 100644 --- a/trunk/drivers/char/tty_port.c +++ b/trunk/drivers/char/tty_port.c @@ -308,6 +308,17 @@ int tty_port_close_start(struct tty_port *port, struct tty_struct *tty, struct f if (port->flags & ASYNC_INITIALIZED && port->closing_wait != ASYNC_CLOSING_WAIT_NONE) tty_wait_until_sent(tty, port->closing_wait); + if (port->drain_delay) { + unsigned int bps = tty_get_baud_rate(tty); + long timeout; + + if (bps > 1200) + timeout = max_t(long, (HZ * 10 * port->drain_delay) / bps, + HZ / 10); + else + timeout = 2 * HZ; + schedule_timeout_interruptible(timeout); + } return 1; } EXPORT_SYMBOL(tty_port_close_start); diff --git a/trunk/include/linux/tty.h b/trunk/include/linux/tty.h index 98694364c96f..bed5a3d40307 100644 --- a/trunk/include/linux/tty.h +++ b/trunk/include/linux/tty.h @@ -201,6 +201,9 @@ struct tty_port { unsigned char *xmit_buf; /* Optional buffer */ int close_delay; /* Close port delay */ int closing_wait; /* Delay for output */ + int drain_delay; /* Set to zero if no pure time + based drain is needed else + set to size of fifo */ }; /*