Skip to content

Commit

Permalink
serial: avoid waking up closed serial ports on resume
Browse files Browse the repository at this point in the history
When we boot, serial ports remain in low power mode until they're used either
by userspace or for the kernel console.

However, if you suspend the system, and then resume, all serial ports will be
taken out of low power mode.  This is bad news for embedded devices where this
can mean higher power consumption.

Only bring a serial port out of low power mode if the port is being used as
the kernel console, or is in use by userspace.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Russell King authored and Linus Torvalds committed Feb 5, 2008
1 parent 74a1974 commit 9d778a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2029,8 +2029,6 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
}
port->suspended = 0;

uart_change_pm(state, 0);

/*
* Re-enable the console device after suspending.
*/
Expand All @@ -2049,6 +2047,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
if (state->info && state->info->tty && termios.c_cflag == 0)
termios = *state->info->tty->termios;

uart_change_pm(state, 0);
port->ops->set_termios(port, &termios, NULL);
console_start(port->cons);
}
Expand All @@ -2057,6 +2056,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
const struct uart_ops *ops = port->ops;
int ret;

uart_change_pm(state, 0);
ops->set_mctrl(port, 0);
ret = ops->startup(port);
if (ret == 0) {
Expand Down

0 comments on commit 9d778a6

Please sign in to comment.