aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/ste_dma40.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/ste_dma40.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/ste_dma40.c')
-rw-r--r--drivers/dma/ste_dma40.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
index 156b98f661a..23e2edc4afd 100644
--- a/drivers/dma/ste_dma40.c
+++ b/drivers/dma/ste_dma40.c
@@ -1220,21 +1220,14 @@ static dma_cookie_t d40_tx_submit(struct dma_async_tx_descriptor *tx)
1220 chan); 1220 chan);
1221 struct d40_desc *d40d = container_of(tx, struct d40_desc, txd); 1221 struct d40_desc *d40d = container_of(tx, struct d40_desc, txd);
1222 unsigned long flags; 1222 unsigned long flags;
1223 dma_cookie_t cookie;
1223 1224
1224 spin_lock_irqsave(&d40c->lock, flags); 1225 spin_lock_irqsave(&d40c->lock, flags);
1225 1226 cookie = dma_cookie_assign(tx);
1226 d40c->chan.cookie++;
1227
1228 if (d40c->chan.cookie < 0)
1229 d40c->chan.cookie = 1;
1230
1231 d40d->txd.cookie = d40c->chan.cookie;
1232
1233 d40_desc_queue(d40c, d40d); 1227 d40_desc_queue(d40c, d40d);
1234
1235 spin_unlock_irqrestore(&d40c->lock, flags); 1228 spin_unlock_irqrestore(&d40c->lock, flags);
1236 1229
1237 return tx->cookie; 1230 return cookie;
1238} 1231}
1239 1232
1240static int d40_start(struct d40_chan *d40c) 1233static int d40_start(struct d40_chan *d40c)