aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/amba-pl08x.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/amba-pl08x.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/amba-pl08x.c')
-rw-r--r--drivers/dma/amba-pl08x.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 346327572cfb..810f696eda4e 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -964,31 +964,17 @@ static enum dma_status pl08x_dma_tx_status(struct dma_chan *chan,
964 dma_cookie_t cookie, struct dma_tx_state *txstate) 964 dma_cookie_t cookie, struct dma_tx_state *txstate)
965{ 965{
966 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); 966 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan);
967 dma_cookie_t last_used;
968 dma_cookie_t last_complete;
969 enum dma_status ret; 967 enum dma_status ret;
970 u32 bytesleft = 0;
971 968
972 last_used = plchan->chan.cookie; 969 ret = dma_cookie_status(chan, cookie, txstate);
973 last_complete = plchan->chan.completed_cookie; 970 if (ret == DMA_SUCCESS)
974
975 ret = dma_async_is_complete(cookie, last_complete, last_used);
976 if (ret == DMA_SUCCESS) {
977 dma_set_tx_state(txstate, last_complete, last_used, 0);
978 return ret; 971 return ret;
979 }
980 972
981 /* 973 /*
982 * This cookie not complete yet 974 * This cookie not complete yet
975 * Get number of bytes left in the active transactions and queue
983 */ 976 */
984 last_used = plchan->chan.cookie; 977 dma_set_residue(txstate, pl08x_getbytes_chan(plchan));
985 last_complete = plchan->chan.completed_cookie;
986
987 /* Get number of bytes left in the active transactions and queue */
988 bytesleft = pl08x_getbytes_chan(plchan);
989
990 dma_set_tx_state(txstate, last_complete, last_used,
991 bytesleft);
992 978
993 if (plchan->state == PL08X_CHAN_PAUSED) 979 if (plchan->state == PL08X_CHAN_PAUSED)
994 return DMA_PAUSED; 980 return DMA_PAUSED;