aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/at_hdmac.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2012-03-06 17:35:27 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-13 02:07:14 -0400
commit96a2af41c78b1fbb1f567a3486bdc63f7b31c5fd (patch)
treed977c6b2ff1a23dfd523e70315ebe976a3f3f079 /drivers/dma/at_hdmac.c
parentf7fbce07c6ce26a25b4e0cb5f241c361fde87901 (diff)
dmaengine: consolidate tx_status functions
Now that we have the completed cookie in the dma_chan structure, we can consolidate the tx_status functions by providing a function to set the txstate structure and returning the DMA status. We also provide a separate helper to set the residue for cookies which are still in progress. 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/at_hdmac.c')
-rw-r--r--drivers/dma/at_hdmac.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index b2826304da24..8a3297418cf0 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -996,26 +996,20 @@ atc_tx_status(struct dma_chan *chan,
996 996
997 spin_lock_irqsave(&atchan->lock, flags); 997 spin_lock_irqsave(&atchan->lock, flags);
998 998
999 last_complete = chan->completed_cookie; 999 ret = dma_cookie_status(chan, cookie, txstate);
1000 last_used = chan->cookie;
1001
1002 ret = dma_async_is_complete(cookie, last_complete, last_used);
1003 if (ret != DMA_SUCCESS) { 1000 if (ret != DMA_SUCCESS) {
1004 atc_cleanup_descriptors(atchan); 1001 atc_cleanup_descriptors(atchan);
1005 1002
1006 last_complete = chan->completed_cookie; 1003 ret = dma_cookie_status(chan, cookie, txstate);
1007 last_used = chan->cookie;
1008
1009 ret = dma_async_is_complete(cookie, last_complete, last_used);
1010 } 1004 }
1011 1005
1006 last_complete = chan->completed_cookie;
1007 last_used = chan->cookie;
1008
1012 spin_unlock_irqrestore(&atchan->lock, flags); 1009 spin_unlock_irqrestore(&atchan->lock, flags);
1013 1010
1014 if (ret != DMA_SUCCESS) 1011 if (ret != DMA_SUCCESS)
1015 dma_set_tx_state(txstate, last_complete, last_used, 1012 dma_set_residue(txstate, atc_first_active(atchan)->len);
1016 atc_first_active(atchan)->len);
1017 else
1018 dma_set_tx_state(txstate, last_complete, last_used, 0);
1019 1013
1020 if (atc_chan_is_paused(atchan)) 1014 if (atc_chan_is_paused(atchan))
1021 ret = DMA_PAUSED; 1015 ret = DMA_PAUSED;