aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuhammad Hamza Farooq <mfarooq@visteon.com>2018-08-10 10:52:48 +0100
committerPavel <pavel@ucw.cz>2019-06-23 12:15:52 +0200
commitadee47100cf9c63333393fe22c2de33c3f196b58 (patch)
tree98caccbbf16319178e4385429b9007d8840bbd67
parente03723e5c2f2b90100267f0f6ff1629893d5d892 (diff)
downloadlinux-cip-adee47100cf9c63333393fe22c2de33c3f196b58.tar.gz
dmaengine: rcar-dmac: use result of updated get_residue in tx_status
The hardware might have complete the transfer but the interrupt handler might not have had a chance to run. If rcar_dmac_chan_get_residue() which reads HW registers finds that there is no residue return DMA_COMPLETE. Signed-off-by: Muhammad Hamza Farooq <mfarooq@visteon.com> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> [Niklas: add explanation in commit message] Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com> (cherry picked from commit 3544d2878817bd139dda238cdd86a15e1c03d037) Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com> Reviewed-by: Biju Das <biju.das@bp.renesas.com> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
-rw-r--r--drivers/dma/sh/rcar-dmac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index a5f38fa3f2cd5c..e465aaf620af30 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1202,6 +1202,10 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan,
residue = rcar_dmac_chan_get_residue(rchan, cookie);
spin_unlock_irqrestore(&rchan->lock, flags);
+ /* if there's no residue, the cookie is complete */
+ if (!residue)
+ return DMA_COMPLETE;
+
dma_set_residue(txstate, residue);
return status;