Release 4.12 drivers/dma/virt-dma.c
  
  
  
/*
 * Virtual DMA channel support for DMAengine
 *
 * Copyright (C) 2012 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#include <linux/device.h>
#include <linux/dmaengine.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include "virt-dma.h"
static struct virt_dma_desc *to_virt_desc(struct dma_async_tx_descriptor *tx)
{
	return container_of(tx, struct virt_dma_desc, tx);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 24 | 100.00% | 1 | 100.00% | 
| Total | 24 | 100.00% | 1 | 100.00% | 
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);
	unsigned long flags;
	dma_cookie_t cookie;
	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",
		vc, vd, cookie);
	return cookie;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 100 | 99.01% | 1 | 50.00% | 
| Robert Jarzmik | 1 | 0.99% | 1 | 50.00% | 
| Total | 101 | 100.00% | 2 | 100.00% | 
EXPORT_SYMBOL_GPL(vchan_tx_submit);
/**
 * vchan_tx_desc_free - free a reusable descriptor
 * @tx: the transfer
 *
 * This function frees a previously allocated reusable descriptor. The only
 * other way is to clear the DMA_CTRL_REUSE flag and submit one last time the
 * transfer.
 *
 * Returns 0 upon success
 */
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);
	unsigned long flags;
	spin_lock_irqsave(&vc->lock, flags);
	list_del(&vd->node);
	spin_unlock_irqrestore(&vc->lock, flags);
	dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: freeing\n",
		vc, vd, vd->tx.cookie);
	vc->desc_free(vd);
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Robert Jarzmik | 97 | 100.00% | 1 | 100.00% | 
| Total | 97 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL_GPL(vchan_tx_desc_free);
struct virt_dma_desc *vchan_find_desc(struct virt_dma_chan *vc,
	dma_cookie_t cookie)
{
	struct virt_dma_desc *vd;
	list_for_each_entry(vd, &vc->desc_issued, node)
		if (vd->tx.cookie == cookie)
			return vd;
	return NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 44 | 100.00% | 1 | 100.00% | 
| Total | 44 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL_GPL(vchan_find_desc);
/*
 * This tasklet handles the completion of a DMA descriptor by
 * calling its callback and freeing it.
 */
static void vchan_complete(unsigned long arg)
{
	struct virt_dma_chan *vc = (struct virt_dma_chan *)arg;
	struct virt_dma_desc *vd, *_vd;
	struct dmaengine_desc_callback cb;
	LIST_HEAD(head);
	spin_lock_irq(&vc->lock);
	list_splice_tail_init(&vc->desc_completed, &head);
	vd = vc->cyclic;
	if (vd) {
		vc->cyclic = NULL;
		dmaengine_desc_get_callback(&vd->tx, &cb);
	} else {
		memset(&cb, 0, sizeof(cb));
	}
	spin_unlock_irq(&vc->lock);
	dmaengine_desc_callback_invoke(&cb, NULL);
	list_for_each_entry_safe(vd, _vd, &head, node) {
		dmaengine_desc_get_callback(&vd->tx, &cb);
		list_del(&vd->node);
		if (dmaengine_desc_test_reuse(&vd->tx))
			list_add(&vd->node, &vc->desc_allocated);
		else
			vc->desc_free(vd);
		dmaengine_desc_callback_invoke(&cb, NULL);
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 114 | 60.32% | 2 | 40.00% | 
| Dave Jiang | 41 | 21.69% | 1 | 20.00% | 
| Robert Jarzmik | 24 | 12.70% | 1 | 20.00% | 
| Andy Shevchenko | 10 | 5.29% | 1 | 20.00% | 
| Total | 189 | 100.00% | 5 | 100.00% | 
void vchan_dma_desc_free_list(struct virt_dma_chan *vc, struct list_head *head)
{
	struct virt_dma_desc *vd, *_vd;
	list_for_each_entry_safe(vd, _vd, head, node) {
		if (dmaengine_desc_test_reuse(&vd->tx)) {
			list_move_tail(&vd->node, &vc->desc_allocated);
		} else {
			dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
			list_del(&vd->node);
			vc->desc_free(vd);
		}
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 53 | 56.99% | 1 | 33.33% | 
| Robert Jarzmik | 29 | 31.18% | 1 | 33.33% | 
| Andy Shevchenko | 11 | 11.83% | 1 | 33.33% | 
| Total | 93 | 100.00% | 3 | 100.00% | 
EXPORT_SYMBOL_GPL(vchan_dma_desc_free_list);
void vchan_init(struct virt_dma_chan *vc, struct dma_device *dmadev)
{
	dma_cookie_init(&vc->chan);
	spin_lock_init(&vc->lock);
	INIT_LIST_HEAD(&vc->desc_allocated);
	INIT_LIST_HEAD(&vc->desc_submitted);
	INIT_LIST_HEAD(&vc->desc_issued);
	INIT_LIST_HEAD(&vc->desc_completed);
	tasklet_init(&vc->task, vchan_complete, (unsigned long)vc);
	vc->chan.device = dmadev;
	list_add_tail(&vc->chan.device_node, &dmadev->channels);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 94 | 92.16% | 1 | 50.00% | 
| Robert Jarzmik | 8 | 7.84% | 1 | 50.00% | 
| Total | 102 | 100.00% | 2 | 100.00% | 
EXPORT_SYMBOL_GPL(vchan_init);
MODULE_AUTHOR("Russell King");
MODULE_LICENSE("GPL");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Russell King | 476 | 67.71% | 3 | 50.00% | 
| Robert Jarzmik | 165 | 23.47% | 1 | 16.67% | 
| Dave Jiang | 41 | 5.83% | 1 | 16.67% | 
| Andy Shevchenko | 21 | 2.99% | 1 | 16.67% | 
| Total | 703 | 100.00% | 6 | 100.00% | 
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.