diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-13 10:28:51 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-13 10:28:51 -0500 |
commit | ee31b337852ca8a65840702544ff5c64d37740f5 (patch) | |
tree | c3da8df25c4084c321e6a96888f7179272a78eaa /drivers/serial | |
parent | 270c7a721548d116d9e054f48469e75cb0f35288 (diff) |
[SERIAL] Fix Bug 4900: S3 resume oops with irattach - Thinkpad A21m
If we fail to re-startup a serial port on resume, shut it down
immediately and mark it as an error condition.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/serial_core.c | 84 |
1 files changed, 49 insertions, 35 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 427a23858076..2331296e1e17 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -209,33 +209,45 @@ static void uart_shutdown(struct uart_state *state) | |||
209 | struct uart_info *info = state->info; | 209 | struct uart_info *info = state->info; |
210 | struct uart_port *port = state->port; | 210 | struct uart_port *port = state->port; |
211 | 211 | ||
212 | if (!(info->flags & UIF_INITIALIZED)) | ||
213 | return; | ||
214 | |||
215 | /* | 212 | /* |
216 | * Turn off DTR and RTS early. | 213 | * Set the TTY IO error marker |
217 | */ | 214 | */ |
218 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) | 215 | if (info->tty) |
219 | uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | 216 | set_bit(TTY_IO_ERROR, &info->tty->flags); |
220 | 217 | ||
221 | /* | 218 | if (info->flags & UIF_INITIALIZED) { |
222 | * clear delta_msr_wait queue to avoid mem leaks: we may free | 219 | info->flags &= ~UIF_INITIALIZED; |
223 | * the irq here so the queue might never be woken up. Note | ||
224 | * that we won't end up waiting on delta_msr_wait again since | ||
225 | * any outstanding file descriptors should be pointing at | ||
226 | * hung_up_tty_fops now. | ||
227 | */ | ||
228 | wake_up_interruptible(&info->delta_msr_wait); | ||
229 | 220 | ||
230 | /* | 221 | /* |
231 | * Free the IRQ and disable the port. | 222 | * Turn off DTR and RTS early. |
232 | */ | 223 | */ |
233 | port->ops->shutdown(port); | 224 | if (!info->tty || (info->tty->termios->c_cflag & HUPCL)) |
225 | uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); | ||
226 | |||
227 | /* | ||
228 | * clear delta_msr_wait queue to avoid mem leaks: we may free | ||
229 | * the irq here so the queue might never be woken up. Note | ||
230 | * that we won't end up waiting on delta_msr_wait again since | ||
231 | * any outstanding file descriptors should be pointing at | ||
232 | * hung_up_tty_fops now. | ||
233 | */ | ||
234 | wake_up_interruptible(&info->delta_msr_wait); | ||
235 | |||
236 | /* | ||
237 | * Free the IRQ and disable the port. | ||
238 | */ | ||
239 | port->ops->shutdown(port); | ||
240 | |||
241 | /* | ||
242 | * Ensure that the IRQ handler isn't running on another CPU. | ||
243 | */ | ||
244 | synchronize_irq(port->irq); | ||
245 | } | ||
234 | 246 | ||
235 | /* | 247 | /* |
236 | * Ensure that the IRQ handler isn't running on another CPU. | 248 | * kill off our tasklet |
237 | */ | 249 | */ |
238 | synchronize_irq(port->irq); | 250 | tasklet_kill(&info->tlet); |
239 | 251 | ||
240 | /* | 252 | /* |
241 | * Free the transmit buffer page. | 253 | * Free the transmit buffer page. |
@@ -244,15 +256,6 @@ static void uart_shutdown(struct uart_state *state) | |||
244 | free_page((unsigned long)info->xmit.buf); | 256 | free_page((unsigned long)info->xmit.buf); |
245 | info->xmit.buf = NULL; | 257 | info->xmit.buf = NULL; |
246 | } | 258 | } |
247 | |||
248 | /* | ||
249 | * kill off our tasklet | ||
250 | */ | ||
251 | tasklet_kill(&info->tlet); | ||
252 | if (info->tty) | ||
253 | set_bit(TTY_IO_ERROR, &info->tty->flags); | ||
254 | |||
255 | info->flags &= ~UIF_INITIALIZED; | ||
256 | } | 259 | } |
257 | 260 | ||
258 | /** | 261 | /** |
@@ -1928,14 +1931,25 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) | |||
1928 | 1931 | ||
1929 | if (state->info && state->info->flags & UIF_INITIALIZED) { | 1932 | if (state->info && state->info->flags & UIF_INITIALIZED) { |
1930 | struct uart_ops *ops = port->ops; | 1933 | struct uart_ops *ops = port->ops; |
1934 | int ret; | ||
1931 | 1935 | ||
1932 | ops->set_mctrl(port, 0); | 1936 | ops->set_mctrl(port, 0); |
1933 | ops->startup(port); | 1937 | ret = ops->startup(port); |
1934 | uart_change_speed(state, NULL); | 1938 | if (ret == 0) { |
1935 | spin_lock_irq(&port->lock); | 1939 | uart_change_speed(state, NULL); |
1936 | ops->set_mctrl(port, port->mctrl); | 1940 | spin_lock_irq(&port->lock); |
1937 | ops->start_tx(port); | 1941 | ops->set_mctrl(port, port->mctrl); |
1938 | spin_unlock_irq(&port->lock); | 1942 | ops->start_tx(port); |
1943 | spin_unlock_irq(&port->lock); | ||
1944 | } else { | ||
1945 | /* | ||
1946 | * Failed to resume - maybe hardware went away? | ||
1947 | * Clear the "initialized" flag so we won't try | ||
1948 | * to call the low level drivers shutdown method. | ||
1949 | */ | ||
1950 | state->info->flags &= ~UIF_INITIALIZED; | ||
1951 | uart_shutdown(state); | ||
1952 | } | ||
1939 | } | 1953 | } |
1940 | 1954 | ||
1941 | up(&state->sem); | 1955 | up(&state->sem); |