aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2016-07-20 16:12:53 -0400
committerVinod Koul <vinod.koul@intel.com>2016-08-07 22:41:41 -0400
commit964b2fd88bf5fffe2997663b04952f2d109f3b54 (patch)
tree57ff5a6cba0ae1c0921dd76f5476836139fbeb9b
parent5ade6683e916df6a00a9747ccc40191fff83a064 (diff)
dmaengine: sh_rcar-dmac: convert callback to helper function
This is in preperation of moving to a callback that provides results to the callback for the transaction. The conversion will maintain current behavior and the driver must convert to new callback mechanism at a later time in order to receive results. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r--drivers/dma/sh/rcar-dmac.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
index 0dd953884d1d..d1defa4646ba 100644
--- a/drivers/dma/sh/rcar-dmac.c
+++ b/drivers/dma/sh/rcar-dmac.c
@@ -1389,21 +1389,18 @@ static irqreturn_t rcar_dmac_isr_channel_thread(int irq, void *dev)
1389{ 1389{
1390 struct rcar_dmac_chan *chan = dev; 1390 struct rcar_dmac_chan *chan = dev;
1391 struct rcar_dmac_desc *desc; 1391 struct rcar_dmac_desc *desc;
1392 struct dmaengine_desc_callback cb;
1392 1393
1393 spin_lock_irq(&chan->lock); 1394 spin_lock_irq(&chan->lock);
1394 1395
1395 /* For cyclic transfers notify the user after every chunk. */ 1396 /* For cyclic transfers notify the user after every chunk. */
1396 if (chan->desc.running && chan->desc.running->cyclic) { 1397 if (chan->desc.running && chan->desc.running->cyclic) {
1397 dma_async_tx_callback callback;
1398 void *callback_param;
1399
1400 desc = chan->desc.running; 1398 desc = chan->desc.running;
1401 callback = desc->async_tx.callback; 1399 dmaengine_desc_get_callback(&desc->async_tx, &cb);
1402 callback_param = desc->async_tx.callback_param;
1403 1400
1404 if (callback) { 1401 if (dmaengine_desc_callback_valid(&cb)) {
1405 spin_unlock_irq(&chan->lock); 1402 spin_unlock_irq(&chan->lock);
1406 callback(callback_param); 1403 dmaengine_desc_callback_invoke(&cb, NULL);
1407 spin_lock_irq(&chan->lock); 1404 spin_lock_irq(&chan->lock);
1408 } 1405 }
1409 } 1406 }
@@ -1418,14 +1415,15 @@ static irqreturn_t rcar_dmac_isr_channel_thread(int irq, void *dev)
1418 dma_cookie_complete(&desc->async_tx); 1415 dma_cookie_complete(&desc->async_tx);
1419 list_del(&desc->node); 1416 list_del(&desc->node);
1420 1417
1421 if (desc->async_tx.callback) { 1418 dmaengine_desc_get_callback(&desc->async_tx, &cb);
1419 if (dmaengine_desc_callback_valid(&cb)) {
1422 spin_unlock_irq(&chan->lock); 1420 spin_unlock_irq(&chan->lock);
1423 /* 1421 /*
1424 * We own the only reference to this descriptor, we can 1422 * We own the only reference to this descriptor, we can
1425 * safely dereference it without holding the channel 1423 * safely dereference it without holding the channel
1426 * lock. 1424 * lock.
1427 */ 1425 */
1428 desc->async_tx.callback(desc->async_tx.callback_param); 1426 dmaengine_desc_callback_invoke(&cb, NULL);
1429 spin_lock_irq(&chan->lock); 1427 spin_lock_irq(&chan->lock);
1430 } 1428 }
1431 1429