diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2012-03-06 17:35:27 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-03-13 02:07:14 -0400 |
commit | 96a2af41c78b1fbb1f567a3486bdc63f7b31c5fd (patch) | |
tree | d977c6b2ff1a23dfd523e70315ebe976a3f3f079 /drivers/dma/txx9dmac.c | |
parent | f7fbce07c6ce26a25b4e0cb5f241c361fde87901 (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/txx9dmac.c')
-rw-r--r-- | drivers/dma/txx9dmac.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 8a5225bf9bc9..bb7b3d96ac6f 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c | |||
@@ -959,27 +959,17 @@ txx9dmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie, | |||
959 | struct dma_tx_state *txstate) | 959 | struct dma_tx_state *txstate) |
960 | { | 960 | { |
961 | struct txx9dmac_chan *dc = to_txx9dmac_chan(chan); | 961 | struct txx9dmac_chan *dc = to_txx9dmac_chan(chan); |
962 | dma_cookie_t last_used; | 962 | enum dma_status ret; |
963 | dma_cookie_t last_complete; | ||
964 | int ret; | ||
965 | 963 | ||
966 | last_complete = chan->completed_cookie; | 964 | ret = dma_cookie_status(chan, cookie, txstate); |
967 | last_used = chan->cookie; | ||
968 | |||
969 | ret = dma_async_is_complete(cookie, last_complete, last_used); | ||
970 | if (ret != DMA_SUCCESS) { | 965 | if (ret != DMA_SUCCESS) { |
971 | spin_lock_bh(&dc->lock); | 966 | spin_lock_bh(&dc->lock); |
972 | txx9dmac_scan_descriptors(dc); | 967 | txx9dmac_scan_descriptors(dc); |
973 | spin_unlock_bh(&dc->lock); | 968 | spin_unlock_bh(&dc->lock); |
974 | 969 | ||
975 | last_complete = chan->completed_cookie; | 970 | ret = dma_cookie_status(chan, cookie, txstate); |
976 | last_used = chan->cookie; | ||
977 | |||
978 | ret = dma_async_is_complete(cookie, last_complete, last_used); | ||
979 | } | 971 | } |
980 | 972 | ||
981 | dma_set_tx_state(txstate, last_complete, last_used, 0); | ||
982 | |||
983 | return ret; | 973 | return ret; |
984 | } | 974 | } |
985 | 975 | ||