From 976ecd12b8144d066a23fe97c6fbfc1ac8470af7 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sun, 3 Jul 2005 21:05:45 +0100 Subject: [PATCH] [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: Russell King --- drivers/serial/serial_core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 139863a787f3..54699c3a00ab 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c @@ -1808,6 +1808,12 @@ uart_set_options(struct uart_port *port, struct console *co, struct termios termios; int i; + /* + * Ensure that the serial console lock is initialised + * early. + */ + spin_lock_init(&port->lock); + memset(&termios, 0, sizeof(struct termios)); termios.c_cflag = CREAD | HUPCL | CLOCAL; @@ -2196,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) state->port = port; - spin_lock_init(&port->lock); port->cons = drv->cons; 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); /* -- 2.20.1