diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2014-04-02 20:16:51 -0700 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-05-02 21:47:01 +0530 |
commit | 91ea74e9ec5c584eef1dcd69554b8315c1ebb0d9 (patch) | |
tree | bf0b97c55ae7b67339a7116f13097c741e9c9918 /drivers/dma | |
parent | 593d9c2e10bc66f1c5cf1adb5eeb709432eb616d (diff) | |
download | linux-91ea74e9ec5c584eef1dcd69554b8315c1ebb0d9.tar.gz linux-91ea74e9ec5c584eef1dcd69554b8315c1ebb0d9.tar.bz2 linux-91ea74e9ec5c584eef1dcd69554b8315c1ebb0d9.zip |
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.c | 18 |
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) static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) { struct shdma_desc *chunk, *c, *desc = - container_of(tx, struct shdma_desc, async_tx), - *last = desc; + container_of(tx, struct shdma_desc, async_tx); struct shdma_chan *schan = to_shdma_chan(tx->chan); dma_async_tx_callback callback = tx->callback; dma_cookie_t cookie; @@ -98,19 +97,20 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_tx_descriptor *tx) &chunk->node == &schan->ld_free)) break; chunk->mark = DESC_SUBMITTED; - /* Callback goes to the last chunk */ - chunk->async_tx.callback = NULL; + if (chunk->chunks == 1) { + chunk->async_tx.callback = callback; + chunk->async_tx.callback_param = tx->callback_param; + } else { + /* Callback goes to the last chunk */ + chunk->async_tx.callback = NULL; + } chunk->cookie = cookie; list_move_tail(&chunk->node, &schan->ld_queue); - last = chunk; dev_dbg(schan->dev, "submit #%d@%p on %d\n", - tx->cookie, &last->async_tx, schan->id); + tx->cookie, &chunk->async_tx, schan->id); } - last->async_tx.callback = callback; - last->async_tx.callback_param = tx->callback_param; - if (power_up) { int ret; schan->pm_state = SHDMA_PM_BUSY; |