From: Stephen Barber Date: Tue, 1 Nov 2016 23:44:27 +0000 (-0700) Subject: dmaengine: pl330: Handle xferred count if DMAMOV hasn't finished X-Git-Tag: v5.15~12265^2~37 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c44da03dd517c11c2b3525937b0a241fc1c69399;p=platform%2Fkernel%2Flinux-starfive.git dmaengine: pl330: Handle xferred count if DMAMOV hasn't finished After executing DMAGO it's possible that a request can come in for the current xferred count, but if that happens too soon then DMAMOV SAR/DAR may not have yet completed. If that happens, we should explicitly return 0 since nothing has been transferred yet. Signed-off-by: Stephen Barber Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index 030fe05..458a712 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c @@ -2263,6 +2263,11 @@ static int pl330_get_current_xferred_count(struct dma_pl330_chan *pch, } pm_runtime_mark_last_busy(pch->dmac->ddma.dev); pm_runtime_put_autosuspend(pl330->ddma.dev); + + /* If DMAMOV hasn't finished yet, SAR/DAR can be zero */ + if (!val) + return 0; + return val - addr; }