From: Cyrille Pitchen Date: Tue, 27 Jan 2015 15:30:29 +0000 (+0100) Subject: dmaengine: at_xdmac: wait for in-progress transaction to complete after pausing a... X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cbb85e672690ad3d02e97aeba33a1e1f722bbacc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git dmaengine: at_xdmac: wait for in-progress transaction to complete after pausing a channel Signed-off-by: Cyrille Pitchen Signed-off-by: Ludovic Desroches Signed-off-by: Vinod Koul --- diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c index c39000b9980a..ed8a576cee7b 100644 --- a/drivers/dma/at_xdmac.c +++ b/drivers/dma/at_xdmac.c @@ -1136,9 +1136,14 @@ static int at_xdmac_device_pause(struct dma_chan *chan) dev_dbg(chan2dev(chan), "%s\n", __func__); + if (test_and_set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status)) + return 0; + spin_lock_bh(&atchan->lock); at_xdmac_write(atxdmac, AT_XDMAC_GRWS, atchan->mask); - set_bit(AT_XDMAC_CHAN_IS_PAUSED, &atchan->status); + while (at_xdmac_chan_read(atchan, AT_XDMAC_CC) + & (AT_XDMAC_CC_WRIP | AT_XDMAC_CC_RDIP)) + cpu_relax(); spin_unlock_bh(&atchan->lock); return 0;