From 97d97224ff361e08777fb33e0fd193ca877dac28 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 1 Sep 2007 21:25:09 +0100 Subject: [PATCH] [SERIAL] Fix console initialisation ordering Ensure pm callback is called upon initialisation to place port in correct power saving state. Ensure console is initialised prior to deciding whether to power down the port. Signed-off-by: Russell King --- drivers/serial/serial_core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index a055f58f34..a3bd3a3f41 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -2126,6 +2126,14 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, port->ops->set_mctrl(port, 0); spin_unlock_irqrestore(&port->lock, flags); + /* + * If this driver supports console, and it hasn't been + * successfully registered yet, try to re-register it. + * It may be that the port was not available. + */ + if (port->cons && !(port->cons->flags & CON_ENABLED)) + register_console(port->cons); + /* * Power down all ports by default, except the * console if we have one. @@ -2286,6 +2294,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) } state->port = port; + state->pm_state = -1; port->cons = drv->cons; port->info = state->info; @@ -2307,15 +2316,6 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) */ tty_register_device(drv->tty_driver, port->line, port->dev); - /* - * If this driver supports console, and it hasn't been - * successfully registered yet, try to re-register it. - * It may be that the port was not available. - */ - if (port->type != PORT_UNKNOWN && - port->cons && !(port->cons->flags & CON_ENABLED)) - register_console(port->cons); - /* * Ensure UPF_DEAD is not set. */ -- 2.39.5