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/coh901318.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/coh901318.c')
-rw-r--r-- | drivers/dma/coh901318.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index 24837d700951..f3505178ff41 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c | |||
@@ -1151,17 +1151,12 @@ coh901318_tx_status(struct dma_chan *chan, dma_cookie_t cookie, | |||
1151 | struct dma_tx_state *txstate) | 1151 | struct dma_tx_state *txstate) |
1152 | { | 1152 | { |
1153 | struct coh901318_chan *cohc = to_coh901318_chan(chan); | 1153 | struct coh901318_chan *cohc = to_coh901318_chan(chan); |
1154 | dma_cookie_t last_used; | 1154 | enum dma_status ret; |
1155 | dma_cookie_t last_complete; | ||
1156 | int ret; | ||
1157 | |||
1158 | last_complete = chan->completed_cookie; | ||
1159 | last_used = chan->cookie; | ||
1160 | 1155 | ||
1161 | ret = dma_async_is_complete(cookie, last_complete, last_used); | 1156 | ret = dma_cookie_status(chan, cookie, txstate); |
1157 | /* FIXME: should be conditional on ret != DMA_SUCCESS? */ | ||
1158 | dma_set_residue(txstate, coh901318_get_bytes_left(chan)); | ||
1162 | 1159 | ||
1163 | dma_set_tx_state(txstate, last_complete, last_used, | ||
1164 | coh901318_get_bytes_left(chan)); | ||
1165 | if (ret == DMA_IN_PROGRESS && cohc->stopped) | 1160 | if (ret == DMA_IN_PROGRESS && cohc->stopped) |
1166 | ret = DMA_PAUSED; | 1161 | ret = DMA_PAUSED; |
1167 | 1162 | ||