aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>2017-05-15 19:09:16 -0400
committerVinod Koul <vinod.koul@intel.com>2017-05-19 05:25:23 -0400
commit30c45005a46bf55ba52086da5e090ec5a2f1c949 (patch)
treeb816d40c7ed9baa351bcca0b50d48c22f3b6066f
parent427d5ecd270bad5b9ba15a42f0414accdfa4e2f8 (diff)
dmaengine: rcar-dmac: implement device_synchronize()
Implement the device_synchronize() callback which wait until a dma channel is stopped to provide a synchronization point. This protects the driver from multiple race conditions when terminating and freeing resources. E.g. the completion callback still running after device_terminate_all() has completed. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/sh/rcar-dmac.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index c68c3336bdad..fb07cd5fe77b 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1365,6 +1365,13 @@ done:
1365 spin_unlock_irqrestore(&rchan->lock, flags); 1365 spin_unlock_irqrestore(&rchan->lock, flags);
1366} 1366}
1367 1367
1368static void rcar_dmac_device_synchronize(struct dma_chan *chan)
1369{
1370 struct rcar_dmac_chan *rchan = to_rcar_dmac_chan(chan);
1371
1372 synchronize_irq(rchan->irq);
1373}
1374
1368/* ----------------------------------------------------------------------------- 1375/* -----------------------------------------------------------------------------
1369 * IRQ handling 1376 * IRQ handling
1370 */ 1377 */
@@ -1846,6 +1853,7 @@ static int rcar_dmac_probe(struct platform_device *pdev)
1846 engine->device_terminate_all = rcar_dmac_chan_terminate_all; 1853 engine->device_terminate_all = rcar_dmac_chan_terminate_all;
1847 engine->device_tx_status = rcar_dmac_tx_status; 1854 engine->device_tx_status = rcar_dmac_tx_status;
1848 engine->device_issue_pending = rcar_dmac_issue_pending; 1855 engine->device_issue_pending = rcar_dmac_issue_pending;
1856 engine->device_synchronize = rcar_dmac_device_synchronize;
1849 1857
1850 ret = dma_async_device_register(engine); 1858 ret = dma_async_device_register(engine);
1851 if (ret < 0) 1859 if (ret < 0)