linux-mips
[Top] [All Lists]

[PATCH] Philips PNX8550 ip3106 driver deadlock fix

To: ralf@linux-mips.org
Subject: [PATCH] Philips PNX8550 ip3106 driver deadlock fix
From: "Vladimir A. Barinov" <vbarinov@ru.mvista.com>
Date: Tue, 06 Dec 2005 20:54:36 +0300
Cc: linux-mips@linux-mips.org, ppopov@embeddedalley.com
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla Thunderbird 1.0.2-6 (X11/20050513)
Hello Ralf,

This is a patch that fixes spin_lock deadlock in serial ip3106 driver.
The spin_lock_irq(&port->lock,flags) is already called in generic driver serial_core.c before
port->ops->start_tx().
So the second call of spin_lock_irq(&port->lock, flags) leads to deadlock. This could be verified in PREEMPT_DESCTOP case when
these options are enabled:
CONFIG_DEBUG_PREEMPT=y
CONFIG_DEBUG_SPINLOCK=y

Vladimir

--- linux-2.6.15/drivers/serial/ip3106_uart.c   2005-12-02 16:37:59.000000000 
+0300
+++ linux-2.6.15/drivers/serial/ip3106_uart.c   2005-12-06 20:40:15.000000000 
+0300
@@ -149,19 +149,14 @@ static void ip3106_stop_tx(struct uart_p
 static void ip3106_start_tx(struct uart_port *port, unsigned int tty_start)
 {
        struct ip3106_port *sport = (struct ip3106_port *)port;
-       unsigned long flags;
        u32 ien;
 
-       spin_lock_irqsave(&sport->port.lock, flags);
-
        /* Clear all pending TX intr */
        serial_out(sport, IP3106_ICLR, IP3106_UART_INT_ALLTX);
 
        /* Enable TX intr */
        ien = serial_in(sport, IP3106_IEN);
        serial_out(sport, IP3106_IEN, ien | IP3106_UART_INT_ALLTX);
-
-       spin_unlock_irqrestore(&sport->port.lock, flags);
 }
 
 /*
<Prev in Thread] Current Thread [Next in Thread>