diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2012-03-06 17:34:06 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2012-03-13 02:06:06 -0400 |
commit | 4d4e58de32a192fea65ab84509d17d199bd291c8 (patch) | |
tree | be35531778c9cc6bee73beb94d07e176a6f3599d /drivers/dma/ep93xx_dma.c | |
parent | 08714f60b0fc6ea3a060b69b32e77139f14e6045 (diff) |
dmaengine: move last completed cookie into generic dma_chan structure
Every DMA engine implementation declares a last completed dma cookie
in their private dma channel structures. This is pointless, and
forces driver specific code. Move this out into the common dma_chan
structure.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Jassi Brar <jassisinghbrar@gmail.com>
[imx-sdma.c & mxs-dma.c]
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Diffstat (limited to 'drivers/dma/ep93xx_dma.c')
-rw-r--r-- | drivers/dma/ep93xx_dma.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c index 59e7a965772b..bc457878cffd 100644 --- a/drivers/dma/ep93xx_dma.c +++ b/drivers/dma/ep93xx_dma.c | |||
@@ -122,7 +122,6 @@ struct ep93xx_dma_desc { | |||
122 | * @lock: lock protecting the fields following | 122 | * @lock: lock protecting the fields following |
123 | * @flags: flags for the channel | 123 | * @flags: flags for the channel |
124 | * @buffer: which buffer to use next (0/1) | 124 | * @buffer: which buffer to use next (0/1) |
125 | * @last_completed: last completed cookie value | ||
126 | * @active: flattened chain of descriptors currently being processed | 125 | * @active: flattened chain of descriptors currently being processed |
127 | * @queue: pending descriptors which are handled next | 126 | * @queue: pending descriptors which are handled next |
128 | * @free_list: list of free descriptors which can be used | 127 | * @free_list: list of free descriptors which can be used |
@@ -157,7 +156,6 @@ struct ep93xx_dma_chan { | |||
157 | #define EP93XX_DMA_IS_CYCLIC 0 | 156 | #define EP93XX_DMA_IS_CYCLIC 0 |
158 | 157 | ||
159 | int buffer; | 158 | int buffer; |
160 | dma_cookie_t last_completed; | ||
161 | struct list_head active; | 159 | struct list_head active; |
162 | struct list_head queue; | 160 | struct list_head queue; |
163 | struct list_head free_list; | 161 | struct list_head free_list; |
@@ -703,7 +701,7 @@ static void ep93xx_dma_tasklet(unsigned long data) | |||
703 | desc = ep93xx_dma_get_active(edmac); | 701 | desc = ep93xx_dma_get_active(edmac); |
704 | if (desc) { | 702 | if (desc) { |
705 | if (desc->complete) { | 703 | if (desc->complete) { |
706 | edmac->last_completed = desc->txd.cookie; | 704 | edmac->chan.completed_cookie = desc->txd.cookie; |
707 | list_splice_init(&edmac->active, &list); | 705 | list_splice_init(&edmac->active, &list); |
708 | } | 706 | } |
709 | callback = desc->txd.callback; | 707 | callback = desc->txd.callback; |
@@ -861,7 +859,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan) | |||
861 | goto fail_clk_disable; | 859 | goto fail_clk_disable; |
862 | 860 | ||
863 | spin_lock_irq(&edmac->lock); | 861 | spin_lock_irq(&edmac->lock); |
864 | edmac->last_completed = 1; | 862 | edmac->chan.completed_cookie = 1; |
865 | edmac->chan.cookie = 1; | 863 | edmac->chan.cookie = 1; |
866 | ret = edmac->edma->hw_setup(edmac); | 864 | ret = edmac->edma->hw_setup(edmac); |
867 | spin_unlock_irq(&edmac->lock); | 865 | spin_unlock_irq(&edmac->lock); |
@@ -1254,7 +1252,7 @@ static enum dma_status ep93xx_dma_tx_status(struct dma_chan *chan, | |||
1254 | 1252 | ||
1255 | spin_lock_irqsave(&edmac->lock, flags); | 1253 | spin_lock_irqsave(&edmac->lock, flags); |
1256 | last_used = chan->cookie; | 1254 | last_used = chan->cookie; |
1257 | last_completed = edmac->last_completed; | 1255 | last_completed = chan->completed_cookie; |
1258 | spin_unlock_irqrestore(&edmac->lock, flags); | 1256 | spin_unlock_irqrestore(&edmac->lock, flags); |
1259 | 1257 | ||
1260 | ret = dma_async_is_complete(cookie, last_completed, last_used); | 1258 | ret = dma_async_is_complete(cookie, last_completed, last_used); |