Set proper console speed on resume if console suspend is disabled Commit b5b82df6, from May 2007, breaks no_console_suspend on the OLPC XO laptop. Basically what happens is that upon returning from resume, serial8250_resume_port() will reconfigure the port for high speed mode and all console output will be garbled, making debug of the resume path painful. This patch modifies uart_resume_port() to reset the port to the state it was in before we suspended. Original patch by Marcelo Tosatti Signed-off-by: Deepak Saxena diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index b0bb29d..3b71038 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -2052,11 +2052,26 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) struct uart_state *state = drv->state + port->line; struct device *tty_dev; struct uart_match match = {port, drv}; + struct ktermios termios; mutex_lock(&state->mutex); + /* + * First try to use the console cflag setting. + */ + memset(&termios, 0, sizeof(struct ktermios)); + termios.c_cflag = port->cons->cflag; + + /* + * If that's unset, use the tty termios setting. + */ + if (termios.c_cflag == 0) + termios = *state->info.port.tty->termios; + + if (!console_suspend_enabled && uart_console(port)) { /* no need to resume serial console, it wasn't suspended */ + port->ops->set_termios(port, &termios, NULL); mutex_unlock(&state->mutex); return 0; } @@ -2073,20 +2088,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port) * Re-enable the console device after suspending. */ if (uart_console(port)) { - struct ktermios termios; - - /* - * First try to use the console cflag setting. - */ - memset(&termios, 0, sizeof(struct ktermios)); - termios.c_cflag = port->cons->cflag; - - /* - * If that's unset, use the tty termios setting. - */ - if (state->info.port.tty && termios.c_cflag == 0) - termios = *state->info.port.tty->termios; - uart_change_pm(state, 0); port->ops->set_termios(port, &termios, NULL); console_start(port->cons);