[RFC 27/34] dmaengine: PL08x: convert to use virt-dma structs
Russell King
rmk+kernel at arm.linux.org.uk
Tue May 29 05:44:20 EDT 2012
Convert PL08x to use the virt-dma structures.
Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
drivers/dma/amba-pl08x.c | 57 +++++++++++++++++++++++----------------------
1 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index 5b6cd1e..6fafebc 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -86,6 +86,7 @@
#include <asm/hardware/pl080.h>
#include "dmaengine.h"
+#include "virt-dma.h"
#define DRIVER_NAME "pl08xdmac"
@@ -158,7 +159,7 @@ struct pl08x_sg {
/**
* struct pl08x_txd - wrapper for struct dma_async_tx_descriptor
- * @tx: async tx descriptor
+ * @vd: virtual DMA descriptor
* @node: node for txd list for channels
* @dsg_list: list of children sg's
* @llis_bus: DMA memory address (physical) start for the LLIs
@@ -167,7 +168,7 @@ struct pl08x_sg {
* @ccfg: config reg values for current txd
*/
struct pl08x_txd {
- struct dma_async_tx_descriptor tx;
+ struct virt_dma_desc vd;
struct list_head node;
struct list_head dsg_list;
dma_addr_t llis_bus;
@@ -201,7 +202,7 @@ enum pl08x_dma_chan_state {
/**
* struct pl08x_dma_chan - this structure wraps a DMA ENGINE channel
- * @chan: wrappped abstract channel
+ * @vc: wrappped virtual channel
* @phychan: the physical channel utilized by this channel, if there is one
* @tasklet: tasklet scheduled by the IRQ to handle actual work etc
* @name: name of channel
@@ -219,7 +220,7 @@ enum pl08x_dma_chan_state {
* @mux_use: count of descriptors using this DMA request signal setting
*/
struct pl08x_dma_chan {
- struct dma_chan chan;
+ struct virt_dma_chan vc;
struct pl08x_phy_chan *phychan;
struct tasklet_struct tasklet;
const char *name;
@@ -280,12 +281,12 @@ struct pl08x_driver_data {
static inline struct pl08x_dma_chan *to_pl08x_chan(struct dma_chan *chan)
{
- return container_of(chan, struct pl08x_dma_chan, chan);
+ return container_of(chan, struct pl08x_dma_chan, vc.chan);
}
static inline struct pl08x_txd *to_pl08x_txd(struct dma_async_tx_descriptor *tx)
{
- return container_of(tx, struct pl08x_txd, tx);
+ return container_of(tx, struct pl08x_txd, vd.tx);
}
/*
@@ -641,14 +642,14 @@ static void pl08x_phy_free(struct pl08x_dma_chan *plchan)
next = NULL;
/* Find a waiting virtual channel for the next transfer. */
- list_for_each_entry(p, &pl08x->memcpy.channels, chan.device_node)
+ list_for_each_entry(p, &pl08x->memcpy.channels, vc.chan.device_node)
if (p->state == PL08X_CHAN_WAITING) {
next = p;
break;
}
if (!next) {
- list_for_each_entry(p, &pl08x->slave.channels, chan.device_node)
+ list_for_each_entry(p, &pl08x->slave.channels, vc.chan.device_node)
if (p->state == PL08X_CHAN_WAITING) {
next = p;
break;
@@ -1344,9 +1345,9 @@ static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan,
struct pl08x_txd *txd = kzalloc(sizeof(*txd), GFP_NOWAIT);
if (txd) {
- dma_async_tx_descriptor_init(&txd->tx, &plchan->chan);
- txd->tx.flags = flags;
- txd->tx.tx_submit = pl08x_tx_submit;
+ dma_async_tx_descriptor_init(&txd->vd.tx, &plchan->vc.chan);
+ txd->vd.tx.flags = flags;
+ txd->vd.tx.tx_submit = pl08x_tx_submit;
INIT_LIST_HEAD(&txd->node);
INIT_LIST_HEAD(&txd->dsg_list);
@@ -1406,7 +1407,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy(
if (ret)
return NULL;
- return &txd->tx;
+ return &txd->vd.tx;
}
static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
@@ -1522,7 +1523,7 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg(
if (ret)
return NULL;
- return &txd->tx;
+ return &txd->vd.tx;
}
static int pl08x_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
@@ -1620,11 +1621,11 @@ static void pl08x_ensure_on(struct pl08x_driver_data *pl08x)
static void pl08x_unmap_buffers(struct pl08x_txd *txd)
{
- struct device *dev = txd->tx.chan->device->dev;
+ struct device *dev = txd->vd.tx.chan->device->dev;
struct pl08x_sg *dsg;
- if (!(txd->tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
- if (txd->tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
+ if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_SRC_UNMAP)) {
+ if (txd->vd.tx.flags & DMA_COMPL_SRC_UNMAP_SINGLE)
list_for_each_entry(dsg, &txd->dsg_list, node)
dma_unmap_single(dev, dsg->src_addr, dsg->len,
DMA_TO_DEVICE);
@@ -1634,8 +1635,8 @@ static void pl08x_unmap_buffers(struct pl08x_txd *txd)
DMA_TO_DEVICE);
}
}
- if (!(txd->tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
- if (txd->tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
+ if (!(txd->vd.tx.flags & DMA_COMPL_SKIP_DEST_UNMAP)) {
+ if (txd->vd.tx.flags & DMA_COMPL_DEST_UNMAP_SINGLE)
list_for_each_entry(dsg, &txd->dsg_list, node)
dma_unmap_single(dev, dsg->dst_addr, dsg->len,
DMA_FROM_DEVICE);
@@ -1660,8 +1661,8 @@ static void pl08x_tasklet(unsigned long data)
while (!list_empty(&head)) {
struct pl08x_txd *txd = list_first_entry(&head,
struct pl08x_txd, node);
- dma_async_tx_callback callback = txd->tx.callback;
- void *callback_param = txd->tx.callback_param;
+ dma_async_tx_callback callback = txd->vd.tx.callback;
+ void *callback_param = txd->vd.tx.callback_param;
list_del(&txd->node);
@@ -1722,7 +1723,7 @@ static irqreturn_t pl08x_irq(int irq, void *dev)
* reservation.
*/
pl08x_release_mux(plchan);
- dma_cookie_complete(&tx->tx);
+ dma_cookie_complete(&tx->vd.tx);
list_add_tail(&tx->node, &plchan->done_list);
/*
@@ -1797,8 +1798,8 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x,
"initialize virtual channel \"%s\"\n",
chan->name);
- chan->chan.device = dmadev;
- dma_cookie_init(&chan->chan);
+ chan->vc.chan.device = dmadev;
+ dma_cookie_init(&chan->vc.chan);
spin_lock_init(&chan->lock);
INIT_LIST_HEAD(&chan->pend_list);
@@ -1807,7 +1808,7 @@ static int pl08x_dma_init_virtual_channels(struct pl08x_driver_data *pl08x,
tasklet_init(&chan->tasklet, pl08x_tasklet,
(unsigned long) chan);
- list_add_tail(&chan->chan.device_node, &dmadev->channels);
+ list_add_tail(&chan->vc.chan.device_node, &dmadev->channels);
}
dev_info(&pl08x->adev->dev, "initialized %d virtual %s channels\n",
i, slave ? "slave" : "memcpy");
@@ -1820,8 +1821,8 @@ static void pl08x_free_virtual_channels(struct dma_device *dmadev)
struct pl08x_dma_chan *next;
list_for_each_entry_safe(chan,
- next, &dmadev->channels, chan.device_node) {
- list_del(&chan->chan.device_node);
+ next, &dmadev->channels, vc.chan.device_node) {
+ list_del(&chan->vc.chan.device_node);
kfree(chan);
}
}
@@ -1872,7 +1873,7 @@ static int pl08x_debugfs_show(struct seq_file *s, void *data)
seq_printf(s, "\nPL08x virtual memcpy channels:\n");
seq_printf(s, "CHANNEL:\tSTATE:\n");
seq_printf(s, "--------\t------\n");
- list_for_each_entry(chan, &pl08x->memcpy.channels, chan.device_node) {
+ list_for_each_entry(chan, &pl08x->memcpy.channels, vc.chan.device_node) {
seq_printf(s, "%s\t\t%s\n", chan->name,
pl08x_state_str(chan->state));
}
@@ -1880,7 +1881,7 @@ static int pl08x_debugfs_show(struct seq_file *s, void *data)
seq_printf(s, "\nPL08x virtual slave channels:\n");
seq_printf(s, "CHANNEL:\tSTATE:\n");
seq_printf(s, "--------\t------\n");
- list_for_each_entry(chan, &pl08x->slave.channels, chan.device_node) {
+ list_for_each_entry(chan, &pl08x->slave.channels, vc.chan.device_node) {
seq_printf(s, "%s\t\t%s\n", chan->name,
pl08x_state_str(chan->state));
}
--
1.7.4.4
More information about the linux-arm-kernel
mailing list