Skip to content

Commit

Permalink
dma: mxs-dma: make mxs_dma_prep_slave_sg() multi user safe
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Vinod Koul <[email protected]>
  • Loading branch information
lw-karo authored and Vinod Koul committed Dec 23, 2011
1 parent feb397d commit 6d23ea4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/dma/mxs-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct mxs_dma_chan {
int chan_irq;
struct mxs_dma_ccw *ccw;
dma_addr_t ccw_phys;
int desc_count;
dma_cookie_t last_completed;
enum dma_status status;
unsigned int flags;
Expand Down Expand Up @@ -386,7 +387,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
struct scatterlist *sg;
int i, j;
u32 *pio;
static int idx;
int idx = append ? mxs_chan->desc_count : 0;

if (mxs_chan->status == DMA_IN_PROGRESS && !append)
return NULL;
Expand Down Expand Up @@ -462,6 +463,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_slave_sg(
}
}
}
mxs_chan->desc_count = idx;

return &mxs_chan->desc;

Expand Down Expand Up @@ -523,6 +525,7 @@ static struct dma_async_tx_descriptor *mxs_dma_prep_dma_cyclic(

i++;
}
mxs_chan->desc_count = i;

return &mxs_chan->desc;

Expand Down

0 comments on commit 6d23ea4

Please sign in to comment.