diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2012-03-06 17:34:06 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-03-13 02:06:06 -0400 |
commit | 4d4e58de32a192fea65ab84509d17d199bd291c8 (patch) | |
tree | be35531778c9cc6bee73beb94d07e176a6f3599d /drivers/dma/intel_mid_dma.c | |
parent | 08714f60b0fc6ea3a060b69b32e77139f14e6045 (diff) |
dmaengine: move last completed cookie into generic dma_chan structure
Every DMA engine implementation declares a last completed dma cookie
in their private dma channel structures. This is pointless, and
forces driver specific code. Move this out into the common dma_chan
structure.
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/intel_mid_dma.c')
-rw-r--r-- | drivers/dma/intel_mid_dma.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c index 923476d74a5d..40e47e6c7ed8 100644 --- a/drivers/dma/intel_mid_dma.c +++ b/drivers/dma/intel_mid_dma.c | |||
@@ -288,7 +288,7 @@ static void midc_descriptor_complete(struct intel_mid_dma_chan *midc, | |||
288 | struct intel_mid_dma_lli *llitem; | 288 | struct intel_mid_dma_lli *llitem; |
289 | void *param_txd = NULL; | 289 | void *param_txd = NULL; |
290 | 290 | ||
291 | midc->completed = txd->cookie; | 291 | midc->chan.completed_cookie = txd->cookie; |
292 | callback_txd = txd->callback; | 292 | callback_txd = txd->callback; |
293 | param_txd = txd->callback_param; | 293 | param_txd = txd->callback_param; |
294 | 294 | ||
@@ -482,12 +482,11 @@ static enum dma_status intel_mid_dma_tx_status(struct dma_chan *chan, | |||
482 | dma_cookie_t cookie, | 482 | dma_cookie_t cookie, |
483 | struct dma_tx_state *txstate) | 483 | struct dma_tx_state *txstate) |
484 | { | 484 | { |
485 | struct intel_mid_dma_chan *midc = to_intel_mid_dma_chan(chan); | ||
486 | dma_cookie_t last_used; | 485 | dma_cookie_t last_used; |
487 | dma_cookie_t last_complete; | 486 | dma_cookie_t last_complete; |
488 | int ret; | 487 | int ret; |
489 | 488 | ||
490 | last_complete = midc->completed; | 489 | last_complete = chan->completed_cookie; |
491 | last_used = chan->cookie; | 490 | last_used = chan->cookie; |
492 | 491 | ||
493 | ret = dma_async_is_complete(cookie, last_complete, last_used); | 492 | ret = dma_async_is_complete(cookie, last_complete, last_used); |
@@ -496,7 +495,7 @@ static enum dma_status intel_mid_dma_tx_status(struct dma_chan *chan, | |||
496 | midc_scan_descriptors(to_middma_device(chan->device), midc); | 495 | midc_scan_descriptors(to_middma_device(chan->device), midc); |
497 | spin_unlock_bh(&midc->lock); | 496 | spin_unlock_bh(&midc->lock); |
498 | 497 | ||
499 | last_complete = midc->completed; | 498 | last_complete = chan->completed_cookie; |
500 | last_used = chan->cookie; | 499 | last_used = chan->cookie; |
501 | 500 | ||
502 | ret = dma_async_is_complete(cookie, last_complete, last_used); | 501 | ret = dma_async_is_complete(cookie, last_complete, last_used); |
@@ -886,7 +885,7 @@ static int intel_mid_dma_alloc_chan_resources(struct dma_chan *chan) | |||
886 | pm_runtime_put(&mid->pdev->dev); | 885 | pm_runtime_put(&mid->pdev->dev); |
887 | return -EIO; | 886 | return -EIO; |
888 | } | 887 | } |
889 | midc->completed = chan->cookie = 1; | 888 | chan->completed_cookie = chan->cookie = 1; |
890 | 889 | ||
891 | spin_lock_bh(&midc->lock); | 890 | spin_lock_bh(&midc->lock); |
892 | while (midc->descs_allocated < DESCS_PER_CHANNEL) { | 891 | while (midc->descs_allocated < DESCS_PER_CHANNEL) { |