Commit 2b99c259 authored by Barry Song's avatar Barry Song Committed by Vinod Koul

DMAEngine: sirf: lock the shared registers access in sirfsoc_dma_terminate_all

Just like Russell pointed out in "DMAEngine: sirf: add DMA
pause/resume support" at
http://www.spinics.net/lists/arm-kernel/msg212496.html
here I find sirfsoc_dma_terminate_all() has same problem,
so move the locking to the front of registers access.
Signed-off-by: default avatarBarry Song <Baohua.Song@csr.com>
Cc: Russell King <linux@arm.linux.org.uk>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 2518d1d1
...@@ -291,6 +291,8 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan) ...@@ -291,6 +291,8 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan)
int cid = schan->chan.chan_id; int cid = schan->chan.chan_id;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&schan->lock, flags);
if (!sdma->is_marco) { if (!sdma->is_marco) {
writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN) & writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN) &
~(1 << cid), sdma->base + SIRFSOC_DMA_INT_EN); ~(1 << cid), sdma->base + SIRFSOC_DMA_INT_EN);
...@@ -305,9 +307,9 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan) ...@@ -305,9 +307,9 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan)
writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_CH_VALID); writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_CH_VALID);
spin_lock_irqsave(&schan->lock, flags);
list_splice_tail_init(&schan->active, &schan->free); list_splice_tail_init(&schan->active, &schan->free);
list_splice_tail_init(&schan->queued, &schan->free); list_splice_tail_init(&schan->queued, &schan->free);
spin_unlock_irqrestore(&schan->lock, flags); spin_unlock_irqrestore(&schan->lock, flags);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment