aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2014-04-02 23:16:51 -0400
committerVinod Koul <vinod.koul@intel.com>2014-05-02 12:17:01 -0400
commit91ea74e9ec5c584eef1dcd69554b8315c1ebb0d9 (patch)
treebf0b97c55ae7b67339a7116f13097c741e9c9918 /drivers/dma
parent593d9c2e10bc66f1c5cf1adb5eeb709432eb616d (diff)
DMA: shdma: tidyup callback chunk finder
Current shdma is using "last" which indicates last desc which needs to have callback function. But that desc's chunks is always 1, we can use it as finder Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> [reflown changelog for readablity] Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/sh/shdma-base.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index 52396771acbe..6786ecbd5ed4 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -73,8 +73,7 @@ static void shdma_chan_xfer_ld_queue(struct shdma_chan *schan)
73static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) 73static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
74{ 74{
75 struct shdma_desc *chunk, *c, *desc = 75 struct shdma_desc *chunk, *c, *desc =
76 container_of(tx, struct shdma_desc, async_tx), 76 container_of(tx, struct shdma_desc, async_tx);
77 *last = desc;
78 struct shdma_chan *schan = to_shdma_chan(tx->chan); 77 struct shdma_chan *schan = to_shdma_chan(tx->chan);
79 dma_async_tx_callback callback = tx->callback; 78 dma_async_tx_callback callback = tx->callback;
80 dma_cookie_t cookie; 79 dma_cookie_t cookie;
@@ -98,19 +97,20 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx)
98 &chunk->node == &schan->ld_free)) 97 &chunk->node == &schan->ld_free))
99 break; 98 break;
100 chunk->mark = DESC_SUBMITTED; 99 chunk->mark = DESC_SUBMITTED;
101 /* Callback goes to the last chunk */ 100 if (chunk->chunks == 1) {
102 chunk->async_tx.callback = NULL; 101 chunk->async_tx.callback = callback;
102 chunk->async_tx.callback_param = tx->callback_param;
103 } else {
104 /* Callback goes to the last chunk */
105 chunk->async_tx.callback = NULL;
106 }
103 chunk->cookie = cookie; 107 chunk->cookie = cookie;
104 list_move_tail(&chunk->node, &schan->ld_queue); 108 list_move_tail(&chunk->node, &schan->ld_queue);
105 last = chunk;
106 109
107 dev_dbg(schan->dev, "submit #%d@%p on %d\n", 110 dev_dbg(schan->dev, "submit #%d@%p on %d\n",
108 tx->cookie, &last->async_tx, schan->id); 111 tx->cookie, &chunk->async_tx, schan->id);
109 } 112 }
110 113
111 last->async_tx.callback = callback;
112 last->async_tx.callback_param = tx->callback_param;
113
114 if (power_up) { 114 if (power_up) {
115 int ret; 115 int ret;
116 schan->pm_state = SHDMA_PM_BUSY; 116 schan->pm_state = SHDMA_PM_BUSY;