dmaengine: virt-dma: Add helper to free/reuse a descriptor
The vchan_vdesc_fini() can be used to free or reuse a given descriptor after it has been marked as completed. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
4fbd8d194f
commit
6af149d2b1
|
@ -107,10 +107,7 @@ static void vchan_complete(unsigned long arg)
|
||||||
dmaengine_desc_get_callback(&vd->tx, &cb);
|
dmaengine_desc_get_callback(&vd->tx, &cb);
|
||||||
|
|
||||||
list_del(&vd->node);
|
list_del(&vd->node);
|
||||||
if (dmaengine_desc_test_reuse(&vd->tx))
|
vchan_vdesc_fini(vd);
|
||||||
list_add(&vd->node, &vc->desc_allocated);
|
|
||||||
else
|
|
||||||
vc->desc_free(vd);
|
|
||||||
|
|
||||||
dmaengine_desc_callback_invoke(&cb, NULL);
|
dmaengine_desc_callback_invoke(&cb, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,20 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
|
||||||
tasklet_schedule(&vc->task);
|
tasklet_schedule(&vc->task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* vchan_vdesc_fini - Free or reuse a descriptor
|
||||||
|
* @vd: virtual descriptor to free/reuse
|
||||||
|
*/
|
||||||
|
static inline void vchan_vdesc_fini(struct virt_dma_desc *vd)
|
||||||
|
{
|
||||||
|
struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
|
||||||
|
|
||||||
|
if (dmaengine_desc_test_reuse(&vd->tx))
|
||||||
|
list_add(&vd->node, &vc->desc_allocated);
|
||||||
|
else
|
||||||
|
vc->desc_free(vd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vchan_cyclic_callback - report the completion of a period
|
* vchan_cyclic_callback - report the completion of a period
|
||||||
* @vd: virtual descriptor
|
* @vd: virtual descriptor
|
||||||
|
|
Loading…
Reference in New Issue