Commit 97d97224 authored by Russell King's avatar Russell King Committed by Russell King

[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: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent a06748ab
...@@ -2126,6 +2126,14 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, ...@@ -2126,6 +2126,14 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state,
port->ops->set_mctrl(port, 0); port->ops->set_mctrl(port, 0);
spin_unlock_irqrestore(&port->lock, flags); 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 * Power down all ports by default, except the
* console if we have one. * console if we have one.
...@@ -2286,6 +2294,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) ...@@ -2286,6 +2294,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
} }
state->port = port; state->port = port;
state->pm_state = -1;
port->cons = drv->cons; port->cons = drv->cons;
port->info = state->info; port->info = state->info;
...@@ -2307,15 +2316,6 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) ...@@ -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); 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. * Ensure UPF_DEAD is not set.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment