#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/module.h>
#include <linux/spinlock.h>
static struct virt_dma_desc *to_virt_desc(struct dma_async_tx_descriptor *tx)
return container_of(tx, struct virt_dma_desc, tx);
dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *tx)
struct virt_dma_chan *vc = to_virt_chan(tx->chan);
struct virt_dma_desc *vd = to_virt_desc(tx);
spin_lock_irqsave(&vc->lock, flags);
cookie = dma_cookie_assign(tx);
list_move_tail(&vd->node, &vc->desc_submitted);
spin_unlock_irqrestore(&vc->lock, flags);
dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: submitted\n",
EXPORT_SYMBOL_GPL(vchan_tx_submit);
int vchan_tx_desc_free(struct dma_async_tx_descriptor *tx)
struct virt_dma_chan *vc = to_virt_chan(tx->chan);
struct virt_dma_desc *vd = to_virt_desc(tx);
spin_lock_irqsave(&vc->lock, flags);
spin_unlock_irqrestore(&vc->lock, flags);
dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: freeing\n",