Commit 4f03ac6a authored by Dave Jiang's avatar Dave Jiang Committed by Vinod Koul

dmaengine: virt-dma: 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: default avatarDave Jiang <dave.jiang@intel.com>
Reviewed-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent d254c8d0
...@@ -87,8 +87,7 @@ static void vchan_complete(unsigned long arg) ...@@ -87,8 +87,7 @@ static void vchan_complete(unsigned long arg)
{ {
struct virt_dma_chan *vc = (struct virt_dma_chan *)arg; struct virt_dma_chan *vc = (struct virt_dma_chan *)arg;
struct virt_dma_desc *vd; struct virt_dma_desc *vd;
dma_async_tx_callback cb = NULL; struct dmaengine_desc_callback cb;
void *cb_data = NULL;
LIST_HEAD(head); LIST_HEAD(head);
spin_lock_irq(&vc->lock); spin_lock_irq(&vc->lock);
...@@ -96,18 +95,17 @@ static void vchan_complete(unsigned long arg) ...@@ -96,18 +95,17 @@ static void vchan_complete(unsigned long arg)
vd = vc->cyclic; vd = vc->cyclic;
if (vd) { if (vd) {
vc->cyclic = NULL; vc->cyclic = NULL;
cb = vd->tx.callback; dmaengine_desc_get_callback(&vd->tx, &cb);
cb_data = vd->tx.callback_param; } else {
memset(&cb, 0, sizeof(cb));
} }
spin_unlock_irq(&vc->lock); spin_unlock_irq(&vc->lock);
if (cb) dmaengine_desc_callback_invoke(&cb, NULL);
cb(cb_data);
while (!list_empty(&head)) { while (!list_empty(&head)) {
vd = list_first_entry(&head, struct virt_dma_desc, node); vd = list_first_entry(&head, struct virt_dma_desc, node);
cb = vd->tx.callback; dmaengine_desc_get_callback(&vd->tx, &cb);
cb_data = vd->tx.callback_param;
list_del(&vd->node); list_del(&vd->node);
if (dmaengine_desc_test_reuse(&vd->tx)) if (dmaengine_desc_test_reuse(&vd->tx))
...@@ -115,8 +113,7 @@ static void vchan_complete(unsigned long arg) ...@@ -115,8 +113,7 @@ static void vchan_complete(unsigned long arg)
else else
vc->desc_free(vd); vc->desc_free(vd);
if (cb) dmaengine_desc_callback_invoke(&cb, NULL);
cb(cb_data);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment