aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/mpc512x_dma.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2012-03-06 17:34:06 -0500
committerVinod Koul <vinod.koul@linux.intel.com>2012-03-13 02:06:06 -0400
commit4d4e58de32a192fea65ab84509d17d199bd291c8 (patch)
treebe35531778c9cc6bee73beb94d07e176a6f3599d /drivers/dma/mpc512x_dma.c
parent08714f60b0fc6ea3a060b69b32e77139f14e6045 (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/mpc512x_dma.c')
-rw-r--r--drivers/dma/mpc512x_dma.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 4d6d4cf66949..39a5cde9f428 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -188,7 +188,6 @@ struct mpc_dma_chan {
188 struct list_head completed; 188 struct list_head completed;
189 struct mpc_dma_tcd *tcd; 189 struct mpc_dma_tcd *tcd;
190 dma_addr_t tcd_paddr; 190 dma_addr_t tcd_paddr;
191 dma_cookie_t completed_cookie;
192 191
193 /* Lock for this structure */ 192 /* Lock for this structure */
194 spinlock_t lock; 193 spinlock_t lock;
@@ -365,7 +364,7 @@ static void mpc_dma_process_completed(struct mpc_dma *mdma)
365 /* Free descriptors */ 364 /* Free descriptors */
366 spin_lock_irqsave(&mchan->lock, flags); 365 spin_lock_irqsave(&mchan->lock, flags);
367 list_splice_tail_init(&list, &mchan->free); 366 list_splice_tail_init(&list, &mchan->free);
368 mchan->completed_cookie = last_cookie; 367 mchan->chan.completed_cookie = last_cookie;
369 spin_unlock_irqrestore(&mchan->lock, flags); 368 spin_unlock_irqrestore(&mchan->lock, flags);
370 } 369 }
371} 370}
@@ -568,7 +567,7 @@ mpc_dma_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
568 567
569 spin_lock_irqsave(&mchan->lock, flags); 568 spin_lock_irqsave(&mchan->lock, flags);
570 last_used = mchan->chan.cookie; 569 last_used = mchan->chan.cookie;
571 last_complete = mchan->completed_cookie; 570 last_complete = mchan->chan.completed_cookie;
572 spin_unlock_irqrestore(&mchan->lock, flags); 571 spin_unlock_irqrestore(&mchan->lock, flags);
573 572
574 dma_set_tx_state(txstate, last_complete, last_used, 0); 573 dma_set_tx_state(txstate, last_complete, last_used, 0);
@@ -742,7 +741,7 @@ static int __devinit mpc_dma_probe(struct platform_device *op)
742 741
743 mchan->chan.device = dma; 742 mchan->chan.device = dma;
744 mchan->chan.cookie = 1; 743 mchan->chan.cookie = 1;
745 mchan->completed_cookie = mchan->chan.cookie; 744 mchan->chan.completed_cookie = mchan->chan.cookie;
746 745
747 INIT_LIST_HEAD(&mchan->free); 746 INIT_LIST_HEAD(&mchan->free);
748 INIT_LIST_HEAD(&mchan->prepared); 747 INIT_LIST_HEAD(&mchan->prepared);