diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-06-29 13:40:53 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-06-29 13:40:53 -0400 |
commit | 0dd7a1aed7c34a39917c4faf75b4230c169e809b (patch) | |
tree | 9c3eea7c817b19b50ece862af063c06ab7216c6d /drivers/serial | |
parent | c5f4644e6c8ba21666128603e4e92544d3cd740d (diff) |
[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.c | 17 |
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) | |||
182 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); | 182 | uart_set_mctrl(port, TIOCM_RTS | TIOCM_DTR); |
183 | } | 183 | } |
184 | 184 | ||
185 | if (info->flags & UIF_CTS_FLOW) { | ||
186 | spin_lock_irq(&port->lock); | ||
187 | if (!(port->ops->get_mctrl(port) & TIOCM_CTS)) | ||
188 | info->tty->hw_stopped = 1; | ||
189 | spin_unlock_irq(&port->lock); | ||
190 | } | ||
191 | |||
185 | info->flags |= UIF_INITIALIZED; | 192 | info->flags |= UIF_INITIALIZED; |
186 | 193 | ||
187 | clear_bit(TTY_IO_ERROR, &info->tty->flags); | 194 | 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 | |||
1134 | spin_unlock_irqrestore(&state->port->lock, flags); | 1141 | spin_unlock_irqrestore(&state->port->lock, flags); |
1135 | } | 1142 | } |
1136 | 1143 | ||
1144 | /* Handle turning on CRTSCTS */ | ||
1145 | if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) { | ||
1146 | spin_lock_irqsave(&state->port->lock, flags); | ||
1147 | if (!(state->port->ops->get_mctrl(state->port) & TIOCM_CTS)) { | ||
1148 | tty->hw_stopped = 1; | ||
1149 | state->port->ops->stop_tx(state->port, 0); | ||
1150 | } | ||
1151 | spin_unlock_irqrestore(&state->port->lock, flags); | ||
1152 | } | ||
1153 | |||
1137 | #if 0 | 1154 | #if 0 |
1138 | /* | 1155 | /* |
1139 | * No need to wake up processes in open wait, since they | 1156 | * No need to wake up processes in open wait, since they |