aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/sirf-dma.c
diff options
context:
space:
mode:
authorBarry Song <Baohua.Song@csr.com>2012-12-14 06:06:58 -0500
committerVinod Koul <vinod.koul@intel.com>2013-01-28 04:44:46 -0500
commit2b99c2592167eb1043e16d1e7187afdc7c940a41 (patch)
treeafeb11ea46e527befcd07b956596ea8cf8c18585 /drivers/dma/sirf-dma.c
parent2518d1d1fc0ba7ef781bac97132bcfd6d7466c4b (diff)
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: Barry Song <Baohua.Song@csr.com> Cc: Russell King <linux@arm.linux.org.uk> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma/sirf-dma.c')
-rw-r--r--drivers/dma/sirf-dma.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c
index 7d78cf7bb7f1..fb5790d8a0b0 100644
--- a/drivers/dma/sirf-dma.c
+++ b/drivers/dma/sirf-dma.c
@@ -291,6 +291,8 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan)
291 int cid = schan->chan.chan_id; 291 int cid = schan->chan.chan_id;
292 unsigned long flags; 292 unsigned long flags;
293 293
294 spin_lock_irqsave(&schan->lock, flags);
295
294 if (!sdma->is_marco) { 296 if (!sdma->is_marco) {
295 writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN) & 297 writel_relaxed(readl_relaxed(sdma->base + SIRFSOC_DMA_INT_EN) &
296 ~(1 << cid), sdma->base + SIRFSOC_DMA_INT_EN); 298 ~(1 << cid), sdma->base + SIRFSOC_DMA_INT_EN);
@@ -305,9 +307,9 @@ static int sirfsoc_dma_terminate_all(struct sirfsoc_dma_chan *schan)
305 307
306 writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_CH_VALID); 308 writel_relaxed(1 << cid, sdma->base + SIRFSOC_DMA_CH_VALID);
307 309
308 spin_lock_irqsave(&schan->lock, flags);
309 list_splice_tail_init(&schan->active, &schan->free); 310 list_splice_tail_init(&schan->active, &schan->free);
310 list_splice_tail_init(&schan->queued, &schan->free); 311 list_splice_tail_init(&schan->queued, &schan->free);
312
311 spin_unlock_irqrestore(&schan->lock, flags); 313 spin_unlock_irqrestore(&schan->lock, flags);
312 314
313 return 0; 315 return 0;