Merge master.kernel.org:/home/rmk/linux-2.6-serial
authorLinus Torvalds <torvalds@g5.osdl.org>
Sun, 3 Jul 2005 21:37:09 +0000 (14:37 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 3 Jul 2005 21:37:09 +0000 (14:37 -0700)
drivers/serial/serial_core.c

index 139863a787f37836e8587efced95c796ed7892dc..54699c3a00ab4e48c1b6c6b196b24ddd80626bc2 100644 (file)
@@ -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);
 
        /*