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/ste_dma40.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/ste_dma40.c')
-rw-r--r-- | drivers/dma/ste_dma40.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index c2463758fed..07b82e367ff 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -2332,25 +2332,19 @@ static enum dma_status d40_tx_status(struct dma_chan *chan, | |||
2332 | struct dma_tx_state *txstate) | 2332 | struct dma_tx_state *txstate) |
2333 | { | 2333 | { |
2334 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); | 2334 | struct d40_chan *d40c = container_of(chan, struct d40_chan, chan); |
2335 | dma_cookie_t last_used; | 2335 | enum dma_status ret; |
2336 | dma_cookie_t last_complete; | ||
2337 | int ret; | ||
2338 | 2336 | ||
2339 | if (d40c->phy_chan == NULL) { | 2337 | if (d40c->phy_chan == NULL) { |
2340 | chan_err(d40c, "Cannot read status of unallocated channel\n"); | 2338 | chan_err(d40c, "Cannot read status of unallocated channel\n"); |
2341 | return -EINVAL; | 2339 | return -EINVAL; |
2342 | } | 2340 | } |
2343 | 2341 | ||
2344 | last_complete = chan->completed_cookie; | 2342 | ret = dma_cookie_status(chan, cookie, txstate); |
2345 | last_used = chan->cookie; | 2343 | if (ret != DMA_SUCCESS) |
2344 | dma_set_residue(txstate, stedma40_residue(chan)); | ||
2346 | 2345 | ||
2347 | if (d40_is_paused(d40c)) | 2346 | if (d40_is_paused(d40c)) |
2348 | ret = DMA_PAUSED; | 2347 | ret = DMA_PAUSED; |
2349 | else | ||
2350 | ret = dma_async_is_complete(cookie, last_complete, last_used); | ||
2351 | |||
2352 | dma_set_tx_state(txstate, last_complete, last_used, | ||
2353 | stedma40_residue(chan)); | ||
2354 | 2348 | ||
2355 | return ret; | 2349 | return ret; |
2356 | } | 2350 | } |