aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/mxs-dma.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2012-03-06 17:34:46 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-13 02:06:52 -0400
commit884485e1f12dcd39390f042e772cdbefc9ebb750 (patch)
treea35fccb601c48ae1ea839aa6d62e4f102f7b66c3 /drivers/dma/mxs-dma.c
parentd2ebfb335b0426deb1a4fb14e4e926d81ecd8235 (diff)
dmaengine: consolidate assignment of DMA cookies
Everyone deals with assigning DMA cookies in the same way (it's part of the API so they should be), so lets consolidate the common code into a helper function to avoid this duplication. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Tested-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Jassi Brar <jassisinghbrar@gmail.com> [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo <shawn.guo@linaro.org> 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.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index daa84ee2a187..4d3b6ff3050f 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -194,19 +194,6 @@ static void mxs_dma_resume_chan(struct mxs_dma_chan *mxs_chan)
194 mxs_chan->status = DMA_IN_PROGRESS; 194 mxs_chan->status = DMA_IN_PROGRESS;
195} 195}
196 196
197static dma_cookie_t mxs_dma_assign_cookie(struct mxs_dma_chan *mxs_chan)
198{
199 dma_cookie_t cookie = mxs_chan->chan.cookie;
200
201 if (++cookie < 0)
202 cookie = 1;
203
204 mxs_chan->chan.cookie = cookie;
205 mxs_chan->desc.cookie = cookie;
206
207 return cookie;
208}
209
210static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan) 197static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
211{ 198{
212 return container_of(chan, struct mxs_dma_chan, chan); 199 return container_of(chan, struct mxs_dma_chan, chan);
@@ -218,7 +205,7 @@ static dma_cookie_t mxs_dma_tx_submit(struct dma_async_tx_descriptor *tx)
218 205
219 mxs_dma_enable_chan(mxs_chan); 206 mxs_dma_enable_chan(mxs_chan);
220 207
221 return mxs_dma_assign_cookie(mxs_chan); 208 return dma_cookie_assign(tx);
222} 209}
223 210
224static void mxs_dma_tasklet(unsigned long data) 211static void mxs_dma_tasklet(unsigned long data)