[PATCH 09/11] ARM: PL08x: fix locking in tasklet
Russell King - ARM Linux
linux at arm.linux.org.uk
Fri Dec 24 05:09:05 EST 2010
Tasklets are run from an interruptible context. The slave DMA functions
can be called from within IRQ handlers. Taking the spinlock without
disabling interrupts allows an interrupt handler to run, which may try
to take the spinlock again, resulting in deadlock. Fix this by using
the irqsave spinlocks.
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
drivers/dma/amba-pl08x.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 79a8679..c0cf46f 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -1626,11 +1626,12 @@ static void pl08x_tasklet(unsigned long data)
struct pl08x_dma_chan *plchan = (struct pl08x_dma_chan *) data;
struct pl08x_phy_chan *phychan = plchan->phychan;
struct pl08x_driver_data *pl08x = plchan->host;
+ unsigned long flags;
if (!plchan)
BUG();
- spin_lock(&plchan->lock);
+ spin_lock_irqsave(&plchan->lock, flags);
if (plchan->at) {
dma_async_tx_callback callback =
@@ -1728,7 +1729,7 @@ static void pl08x_tasklet(unsigned long data)
}
}
- spin_unlock(&plchan->lock);
+ spin_unlock_irqrestore(&plchan->lock, flags);
}
static irqreturn_t pl08x_irq(int irq, void *dev)
--
1.6.2.5
More information about the linux-arm-kernel
mailing list