提交 976ecd12 编写于 作者: R Russell King 提交者: Russell King

[PATCH] Serial: Fix console port spinlock initialisation

Initialise the spinlock for port being used by the console early, but
don't re-initialise it again later.
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 1d6bebf2
...@@ -1808,6 +1808,12 @@ uart_set_options(struct uart_port *port, struct console *co, ...@@ -1808,6 +1808,12 @@ uart_set_options(struct uart_port *port, struct console *co,
struct termios termios; struct termios termios;
int i; int i;
/*
* Ensure that the serial console lock is initialised
* early.
*/
spin_lock_init(&port->lock);
memset(&termios, 0, sizeof(struct termios)); memset(&termios, 0, sizeof(struct termios));
termios.c_cflag = CREAD | HUPCL | CLOCAL; termios.c_cflag = CREAD | HUPCL | CLOCAL;
...@@ -2196,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) ...@@ -2196,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
state->port = port; state->port = port;
spin_lock_init(&port->lock);
port->cons = drv->cons; port->cons = drv->cons;
port->info = state->info; port->info = state->info;
/*
* If this port is a console, then the spinlock is already
* initialised.
*/
if (!uart_console(port))
spin_lock_init(&port->lock);
uart_configure_port(drv, state, port); uart_configure_port(drv, state, port);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册