]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SERIAL] initialize spinlock for port failed to setup console
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>
Thu, 2 Feb 2006 20:53:39 +0000 (20:53 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 2 Feb 2006 20:53:39 +0000 (20:53 +0000)
It seems serial_core intend to initialize port->lock just once for each
ports.  This is done in uart_set_options() for console, and in
uart_add_one_port() for other ports.  But there is a case the port->lock is
not initialized by serial_core.  If the setup function for the console was
failed, it will not call uart_set_options() but the port is marked as
console (uart_console(port) returns 1).  It can happen if console was PCI
port which can not detected at the time of register_console.

This patch is to initialize port->lock for such console port.  With this
change, most of spin_lock_init() (some of them are labeled "Temporary
fix.") in low-level serial drivers can be omitted.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/serial/serial_core.c

index 0717abfdae06f1eed3d132cdbd7e7a3cced60858..95fb4939c675f8119a2b630c6e23a380fc7a9d44 100644 (file)
@@ -2237,7 +2237,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port)
         * If this port is a console, then the spinlock is already
         * initialised.
         */
-       if (!uart_console(port))
+       if (!(uart_console(port) && (port->cons->flags & CON_ENABLED)))
                spin_lock_init(&port->lock);
 
        uart_configure_port(drv, state, port);