mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
dmaengine: sh: rcar-dmac: With cyclic DMA residue 0 is valid
commit907bd68a2eupstream. Having a cyclic DMA, a residue 0 is not an indication of a completed DMA. In case of cyclic DMA make sure that dma_set_residue() is called and with this a residue of 0 is forwarded correctly to the caller. Fixes:3544d28788("dmaengine: rcar-dmac: use result of updated get_residue in tx_status") Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com> Signed-off-by: Achim Dahlhoff <Achim.Dahlhoff@de.bosch.com> Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Yao Lihua <ylhuajnu@outlook.com> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: <stable@vger.kernel.org> # v4.8+ Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
73a95f1a41
commit
5db50e4f36
@@ -1332,6 +1332,7 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan,
|
||||
enum dma_status status;
|
||||
unsigned long flags;
|
||||
unsigned int residue;
|
||||
bool cyclic;
|
||||
|
||||
status = dma_cookie_status(chan, cookie, txstate);
|
||||
if (status == DMA_COMPLETE || !txstate)
|
||||
@@ -1339,10 +1340,11 @@ static enum dma_status rcar_dmac_tx_status(struct dma_chan *chan,
|
||||
|
||||
spin_lock_irqsave(&rchan->lock, flags);
|
||||
residue = rcar_dmac_chan_get_residue(rchan, cookie);
|
||||
cyclic = rchan->desc.running ? rchan->desc.running->cyclic : false;
|
||||
spin_unlock_irqrestore(&rchan->lock, flags);
|
||||
|
||||
/* if there's no residue, the cookie is complete */
|
||||
if (!residue)
|
||||
if (!residue && !cyclic)
|
||||
return DMA_COMPLETE;
|
||||
|
||||
dma_set_residue(txstate, residue);
|
||||
|
||||
Reference in New Issue
Block a user