summaryrefslogtreecommitdiff
path: root/drivers/serial/mux.c
diff options
context:
space:
mode:
authorRyan Bradetich <rbrad@parisc-linux.org>2005-11-17 16:38:28 -0500
committerKyle McMartin <kyle@parisc-linux.org>2005-11-17 16:38:28 -0500
commita137ce8536f6124c42ac300be01b9b611c7db5a1 (patch)
tree5aedf1c236c7ed0a8dc5ed51e584b03d02d200fd /drivers/serial/mux.c
parent83aceb5b6a561c7fd7cc2d481fb55a0a2ae37c12 (diff)
[PARISC] Define port->timeout to fix a long msleep in mux.c
This commit is in response to a bug reported by Vesa on the irc channel a couple of weeks ago. The bug was that the console would apparently hang (not return) while using the mux console. The root cause of this bug is that bash (with readline support) makes a call to the tcsetattr() glibc function with the argument TCSADRAIN. This causes the serial core in the kernel use the uart_wait_until_sent() to be called. This function verifies the mux transmit queue is empty or calls the msleep_interruptable() with a calculated timeout value that is dependant upon the port->timeout variable. The real problem here is that the port->timeout was not defined so it was defaulted to 0 and the timeout calculation performs the following calculation: char_time = (port->timeout - HZ/50) / port->fifosize; where char_time is an unsigned long. Since the serial Mux does not use interrupts, the msleep_interruptable() function waits until the timeout has been reached ... and when the port->timeout < HZ/50 this timeout will be a long time. (I have validated that the console will eventually return ... but it takes quite a while for this to happen). This patch simply sets the port->timeout on the Mux to HZ/50 to avoid this long timeout period. Signed-off-by: Ryan Bradetich <rbrad@parisc-linux.org> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'drivers/serial/mux.c')
-rw-r--r--drivers/serial/mux.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c
index 36e3bcb1ebf0..7633132a10aa 100644
--- a/drivers/serial/mux.c
+++ b/drivers/serial/mux.c
@@ -477,6 +477,13 @@ static int __init mux_probe(struct parisc_device *dev)
port->ops = &mux_pops;
port->flags = UPF_BOOT_AUTOCONF;
port->line = port_cnt;
+
+ /* The port->timeout needs to match what is present in
+ * uart_wait_until_sent in serial_core.c. Otherwise
+ * the time spent in msleep_interruptable will be very
+ * long, causing the appearance of a console hang.
+ */
+ port->timeout = HZ / 50;
spin_lock_init(&port->lock);
status = uart_add_one_port(&mux_driver, port);
BUG_ON(status);