Thread (35 messages) 35 messages, 9 authors, 2012-04-23

[PATCH 7/9] dmaengine: consolidate initialization of cookies

flat view
STALE5291d REVIEWED: 6 (6M)

From: H Hartley Sweeten <hidden>
Date: 2012-03-07 01:07:37

Revision v2 of 3 in this series; 2 review trailers.

Revisions (3)
  1. v1 [diff vs current]
  2. v2
  3. v2 current
On Tuesday, March 06, 2012 3:36 PM, Russell King wrote:
Provide a common function to initialize a channels cookie values.

Signed-off-by: Russell King <redacted>
---
<snip>
 drivers/dma/dmaengine.h     |   10 ++++++++++
<snip>
 drivers/dma/ep93xx_dma.c    |    3 +--
<snip>
quoted hunk ↗ jump to hunk
diff --git a/drivers/dma/dmaengine.h b/drivers/dma/dmaengine.h
index 1ca5e0e..17f983a 100644
--- a/drivers/dma/dmaengine.h
+++ b/drivers/dma/dmaengine.h
@@ -9,6 +9,16 @@
 #include <linux/dmaengine.h>
 
 /**
+ * dma_cookie_init - initialize the cookies for a DMA channel
+ * @chan: dma channel to initialize
+ */
+static inline void dma_cookie_init(struct dma_chan *chan)
+{
+	chan->cookie = DMA_MIN_COOKIE;
+	chan->completed_cookie = DMA_MIN_COOKIE;
+}
+
+/**
  * dma_cookie_assign - assign a DMA engine cookie to the descriptor
  * @tx: descriptor needing cookie
  *
<snip>
quoted hunk ↗ jump to hunk
diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
index 142ebf0..f25e83b 100644
--- a/drivers/dma/ep93xx_dma.c
+++ b/drivers/dma/ep93xx_dma.c
@@ -854,8 +854,7 @@ static int ep93xx_dma_alloc_chan_resources(struct dma_chan *chan)
 		goto fail_clk_disable;
 
 	spin_lock_irq(&edmac->lock);
-	edmac->chan.completed_cookie = 1;
-	edmac->chan.cookie = 1;
+	dma_cookie_init(&edmac->chan);
 	ret = edmac->edma->hw_setup(edmac);
 	spin_unlock_irq(&edmac->lock);
 
For ep93xx:

Tested-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help