diff options
-rw-r--r-- | drivers/serial/serial_core.c | 14 |
1 files changed, 13 insertions, 1 deletions
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, | |||
1808 | struct termios termios; | 1808 | struct termios termios; |
1809 | int i; | 1809 | int i; |
1810 | 1810 | ||
1811 | /* | ||
1812 | * Ensure that the serial console lock is initialised | ||
1813 | * early. | ||
1814 | */ | ||
1815 | spin_lock_init(&port->lock); | ||
1816 | |||
1811 | memset(&termios, 0, sizeof(struct termios)); | 1817 | memset(&termios, 0, sizeof(struct termios)); |
1812 | 1818 | ||
1813 | termios.c_cflag = CREAD | HUPCL | CLOCAL; | 1819 | termios.c_cflag = CREAD | HUPCL | CLOCAL; |
@@ -2196,10 +2202,16 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2196 | 2202 | ||
2197 | state->port = port; | 2203 | state->port = port; |
2198 | 2204 | ||
2199 | spin_lock_init(&port->lock); | ||
2200 | port->cons = drv->cons; | 2205 | port->cons = drv->cons; |
2201 | port->info = state->info; | 2206 | port->info = state->info; |
2202 | 2207 | ||
2208 | /* | ||
2209 | * If this port is a console, then the spinlock is already | ||
2210 | * initialised. | ||
2211 | */ | ||
2212 | if (!uart_console(port)) | ||
2213 | spin_lock_init(&port->lock); | ||
2214 | |||
2203 | uart_configure_port(drv, state, port); | 2215 | uart_configure_port(drv, state, port); |
2204 | 2216 | ||
2205 | /* | 2217 | /* |