From 884485e1f12dcd39390f042e772cdbefc9ebb750 Mon Sep 17 00:00:00 2001 From: Russell King - ARM Linux Date: Tue, 6 Mar 2012 22:34:46 +0000 Subject: 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 Tested-by: Linus Walleij Reviewed-by: Linus Walleij Acked-by: Jassi Brar [imx-sdma.c & mxs-dma.c] Tested-by: Shawn Guo Signed-off-by: Vinod Koul --- drivers/dma/coh901318.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'drivers/dma/coh901318.c') diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index fb0d124..843a1a3 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, return 0; } -static dma_cookie_t -coh901318_assign_cookie(struct coh901318_chan *cohc, - struct coh901318_desc *cohd) -{ - dma_cookie_t cookie = cohc->chan.cookie; - - if (++cookie < 0) - cookie = 1; - - cohc->chan.cookie = cookie; - cohd->desc.cookie = cookie; - - return cookie; -} static struct coh901318_desc * coh901318_desc_get(struct coh901318_chan *cohc) @@ -966,16 +952,16 @@ coh901318_tx_submit(struct dma_async_tx_descriptor *tx) desc); struct coh901318_chan *cohc = to_coh901318_chan(tx->chan); unsigned long flags; + dma_cookie_t cookie; spin_lock_irqsave(&cohc->lock, flags); - - tx->cookie = coh901318_assign_cookie(cohc, cohd); + cookie = dma_cookie_assign(tx); coh901318_desc_queue(cohc, cohd); spin_unlock_irqrestore(&cohc->lock, flags); - return tx->cookie; + return cookie; } static struct dma_async_tx_descriptor * -- cgit v1.1