aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/mxs-dma.c
diff options
context:
space:
mode:
authorLothar Waßmann <LW@KARO-electronics.de>2011-12-08 03:15:43 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2011-12-23 10:24:55 -0500
commit6d23ea4b1906f28f5d99ad6aeef7207c48be6bfd (patch)
treed448c976c70aa3bf028fb9cf8c91a7b7f046129d /drivers/dma/mxs-dma.c
parentfeb397de65c3f76e40ef70e264f2cdf688c850c1 (diff)
dma: mxs-dma: make mxs_dma_prep_slave_sg() multi user safe
Using a static variable for counting the number of CCWs attached to a DMA channel when appending a new descriptor is not multi user safe. Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/mxs-dma.c')
-rw-r--r--drivers/dma/mxs-dma.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index b0e6ac3e09aa..1b4c6be3aacb 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -111,6 +111,7 @@ struct mxs_dma_chan {
111 int chan_irq; 111 int chan_irq;
112 struct mxs_dma_ccw *ccw; 112 struct mxs_dma_ccw *ccw;
113 dma_addr_t ccw_phys; 113 dma_addr_t ccw_phys;
114 int desc_count;
114 dma_cookie_t last_completed; 115 dma_cookie_t last_completed;
115 enum dma_status status; 116 enum dma_status status;
116 unsigned int flags; 117 unsigned int flags;
@@ -386,7 +387,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
386 struct scatterlist *sg; 387 struct scatterlist *sg;
387 int i, j; 388 int i, j;
388 u32 *pio; 389 u32 *pio;
389 static int idx; 390 int idx = append ? mxs_chan->desc_count : 0;
390 391
391 if (mxs_chan->status == DMA_IN_PROGRESS && !append) 392 if (mxs_chan->status == DMA_IN_PROGRESS && !append)
392 return NULL; 393 return NULL;
@@ -462,6 +463,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
462 } 463 }
463 } 464 }
464 } 465 }
466 mxs_chan->desc_count = idx;
465 467
466 return &mxs_chan->desc; 468 return &mxs_chan->desc;
467 469
@@ -523,6 +525,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(
523 525
524 i++; 526 i++;
525 } 527 }
528 mxs_chan->desc_count = i;
526 529
527 return &mxs_chan->desc; 530 return &mxs_chan->desc;
528 531