aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-29 18:40:53 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-06-29 18:40:53 +0100
commit0dd7a1aed7c34a39917c4faf75b4230c169e809b (patch)
tree9c3eea7c817b19b50ece862af063c06ab7216c6d /drivers/serial
parent[PATCH] Serial: Adjust serial locking (diff)
downloadlinux-dev-0dd7a1aed7c34a39917c4faf75b4230c169e809b.tar.xz
linux-dev-0dd7a1aed7c34a39917c4faf75b4230c169e809b.zip
[PATCH] Serial: Check status of CTS when using flow control
Fix bugme #4712: read the CTS status and set hw_stopped if CTS is not active when opening the port and/or enabling CRTSCTS Thanks to Stefan Wolff for spotting this problem. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_core.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index f5ce58d0514d..139863a787f3 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -182,6 +182,13 @@ static int uart_startup(struct uart_state *state, int init_hw)
uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR);
}
+ if (info->flags & UIF_CTS_FLOW) {
+ spin_lock_irq(&port->lock);
+ if (!(port->ops->get_mctrl(port) & TIOCM_CTS))
+ info->tty->hw_stopped = 1;
+ spin_unlock_irq(&port->lock);
+ }
+
info->flags |= UIF_INITIALIZED;
clear_bit(TTY_IO_ERROR, &info->tty->flags);
@@ -1134,6 +1141,16 @@ static void uart_set_termios(struct tty_struct *tty, struct termios *old_termios
spin_unlock_irqrestore(&state->port->lock, flags);
}
+ /* Handle turning on CRTSCTS */
+ if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
+ spin_lock_irqsave(&state->port->lock, flags);
+ if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) {
+ tty->hw_stopped = 1;
+ state->port->ops->stop_tx(state->port, 0);
+ }
+ spin_unlock_irqrestore(&state->port->lock, flags);
+ }
+
#if 0
/*
* No need to wake up processes in open wait, since they