linux-mips
[Top] [All Lists]

[PATCH] serial_txx9: forcibly init the spinlock for PCI UART used as a c

To: rmk+serial@arm.linux.org.uk
Subject: [PATCH] serial_txx9: forcibly init the spinlock for PCI UART used as a console
From: Sergei Shtylylov <sshtylyov@ru.mvista.com>
Date: Tue, 27 Dec 2005 01:24:52 +0300
Cc: linux-mips@linux-mips.org, anemo@mba.ocn.ne.jp
Organization: MostaVista Software Inc.
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.2) Gecko/20040803
Hello.

       When a system console gets assigned to the UART located on the Toshiba
GOKU-S PCI card, the port spinlock is not initialized at all --
uart_add_one_port() thinks it's been initialized by the console setup code
which is called too early for being able to do that, before the PCI card is
even detected by the driver, and therefore fails. That unitialized spinlock
causes 3 BUG messages in the boot log with Ingo Molnar's RT preemption patch
as uart_add_one_port() called to register PCI UART with the serial core calls
uart_configure_port() which makes use of the port spinlock.

WBR, Sergei

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>


diff --git a/drivers/serial/serial_txx9.c b/drivers/serial/serial_txx9.c
index f10c86d..3f8dc41 100644
--- a/drivers/serial/serial_txx9.c
+++ b/drivers/serial/serial_txx9.c
@@ -1065,6 +1065,14 @@ static int __devinit serial_txx9_registe
                uart->port.mapbase  = port->mapbase;
                if (port->dev)
                        uart->port.dev = port->dev;
+
+               /*
+                * If this port is a console, its spinlock couldn't have been
+                * initialized by serial_txx9_console_setup() and it won't be
+                * initialized by uart_add_one_port(), so have to do it here...
+                */
+               spin_lock_init(&uart->port.lock);
+
                ret = uart_add_one_port(&serial_txx9_reg, &uart->port);
                if (ret == 0)
                        ret = uart->port.line;




<Prev in Thread] Current Thread [Next in Thread>