aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dw_dmac.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/dw_dmac.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/dw_dmac.c')
-rw-r--r--drivers/dma/dw_dmac.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index 12ea60b2a1be..33bde5da850d 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -979,28 +979,17 @@ dwc_tx_status(struct dma_chan *chan,
979 struct dma_tx_state *txstate) 979 struct dma_tx_state *txstate)
980{ 980{
981 struct dw_dma_chan *dwc = to_dw_dma_chan(chan); 981 struct dw_dma_chan *dwc = to_dw_dma_chan(chan);
982 dma_cookie_t last_used; 982 enum dma_status ret;
983 dma_cookie_t last_complete;
984 int ret;
985 983
986 last_complete = chan->completed_cookie; 984 ret = dma_cookie_status(chan, cookie, txstate);
987 last_used = chan->cookie;
988
989 ret = dma_async_is_complete(cookie, last_complete, last_used);
990 if (ret != DMA_SUCCESS) { 985 if (ret != DMA_SUCCESS) {
991 dwc_scan_descriptors(to_dw_dma(chan->device), dwc); 986 dwc_scan_descriptors(to_dw_dma(chan->device), dwc);
992 987
993 last_complete = chan->completed_cookie; 988 ret = dma_cookie_status(chan, cookie, txstate);
994 last_used = chan->cookie;
995
996 ret = dma_async_is_complete(cookie, last_complete, last_used);
997 } 989 }
998 990
999 if (ret != DMA_SUCCESS) 991 if (ret != DMA_SUCCESS)
1000 dma_set_tx_state(txstate, last_complete, last_used, 992 dma_set_residue(txstate, dwc_first_active(dwc)->len);
1001 dwc_first_active(dwc)->len);
1002 else
1003 dma_set_tx_state(txstate, last_complete, last_used, 0);
1004 993
1005 if (dwc->paused) 994 if (dwc->paused)
1006 return DMA_PAUSED; 995 return DMA_PAUSED;