summaryrefslogtreecommitdiffstats
path: root/drivers/dma/virt-dma.h
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2017-11-14 09:32:03 -0500
committerVinod Koul <vinod.koul@intel.com>2017-12-04 12:03:51 -0500
commit6af149d2b1422e0e873d8558274713e6f63142c2 (patch)
tree781a20e50da84484666dc5152bbead514d59f386 /drivers/dma/virt-dma.h
parent4fbd8d194f06c8a3fd2af1ce560ddb31f7ec8323 (diff)
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>
Diffstat (limited to 'drivers/dma/virt-dma.h')
-rw-r--r--drivers/dma/virt-dma.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/dma/virt-dma.h b/drivers/dma/virt-dma.h
index 3f776a46a29c..2edb05505102 100644
--- a/drivers/dma/virt-dma.h
+++ b/drivers/dma/virt-dma.h
@@ -104,6 +104,20 @@ static inline void vchan_cookie_complete(struct virt_dma_desc *vd)
104} 104}
105 105
106/** 106/**
107 * vchan_vdesc_fini - Free or reuse a descriptor
108 * @vd: virtual descriptor to free/reuse
109 */
110static inline void vchan_vdesc_fini(struct virt_dma_desc *vd)
111{
112 struct virt_dma_chan *vc = to_virt_chan(vd->tx.chan);
113
114 if (dmaengine_desc_test_reuse(&vd->tx))
115 list_add(&vd->node, &vc->desc_allocated);
116 else
117 vc->desc_free(vd);
118}
119
120/**
107 * vchan_cyclic_callback - report the completion of a period 121 * vchan_cyclic_callback - report the completion of a period
108 * @vd: virtual descriptor 122 * @vd: virtual descriptor
109 */ 123 */