aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/coh901318.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/coh901318.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/coh901318.c')
-rw-r--r--drivers/dma/coh901318.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index fb0d1245ade5..843a1a3b8a81 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -318,20 +318,6 @@ static int coh901318_prep_linked_list(struct coh901318_chan *cohc,
318 318
319 return 0; 319 return 0;
320} 320}
321static dma_cookie_t
322coh901318_assign_cookie(struct coh901318_chan *cohc,
323 struct coh901318_desc *cohd)
324{
325 dma_cookie_t cookie = cohc->chan.cookie;
326
327 if (++cookie < 0)
328 cookie = 1;
329
330 cohc->chan.cookie = cookie;
331 cohd->desc.cookie = cookie;
332
333 return cookie;
334}
335 321
336static struct coh901318_desc * 322static struct coh901318_desc *
337coh901318_desc_get(struct coh901318_chan *cohc) 323coh901318_desc_get(struct coh901318_chan *cohc)
@@ -966,16 +952,16 @@ coh901318_tx_submit(struct dma_async_tx_descriptor *tx)
966 desc); 952 desc);
967 struct coh901318_chan *cohc = to_coh901318_chan(tx->chan); 953 struct coh901318_chan *cohc = to_coh901318_chan(tx->chan);
968 unsigned long flags; 954 unsigned long flags;
955 dma_cookie_t cookie;
969 956
970 spin_lock_irqsave(&cohc->lock, flags); 957 spin_lock_irqsave(&cohc->lock, flags);
971 958 cookie = dma_cookie_assign(tx);
972 tx->cookie = coh901318_assign_cookie(cohc, cohd);
973 959
974 coh901318_desc_queue(cohc, cohd); 960 coh901318_desc_queue(cohc, cohd);
975 961
976 spin_unlock_irqrestore(&cohc->lock, flags); 962 spin_unlock_irqrestore(&cohc->lock, flags);
977 963
978 return tx->cookie; 964 return cookie;
979} 965}
980 966
981static struct dma_async_tx_descriptor * 967static struct dma_async_tx_descriptor *