Skip to contentSkip to conversation

of: dma: make #dma-cells optional

PATCH In review Rob Herring 3 participants 5 messages Feb 28, 2013 – Mar 7, 2013 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 of: dma: make #dma-cells optional

From: Rob Herring <[email protected]>

For controllers with no requests/clients (memory to memory only), the

Cc Vinod Koul <[email protected]>
Cc Dan Williams <[email protected]>
Cc Grant Likely <[email protected]>
---
 Documentation/devicetree/bindings/dma/dma.txt |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/dma/dma.txt +4 -3
index 8f504e6..d388f06 100644
@@ -8,9 +8,10 @@ controller.
 * DMA controller
 
 Required property:
-- #dma-cells: 		Must be at least 1. Used to provide DMA controller
-			specific information. See DMA client binding below for
-			more details.
+- #dma-cells: 		Required for controllers with requests. Optional for
+			memory to memory only DMA controllers. Must be at least
+			1. Used to provide DMA controller specific information. 
+			See DMA client binding below for more details.
 
 Optional properties:
 - dma-channels: 	Number of DMA channels supported by the controller.
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 dma: of: allow for non-existent #dma-cells property

From: Rob Herring <[email protected]>

Allow the #dma-cells property to be optional and default to 0. This fixes a crash on Calxed highbank which has no clients and no #dma-cells property.

Also, the error check was pointless as be32_to_cpup causes a NULL ptr error first before we get to the error check.

Cc Vinod Koul <[email protected]>
Cc Dan Williams <[email protected]>
Cc Grant Likely <[email protected]>
---
 drivers/dma/of-dma.c |   10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/dma/of-dma.c +2 -8
index 69d04d2..e97a062 100644
@@ -92,7 +92,7 @@ int of_dma_controller_register(struct device_node *np,
 				void *data)
 {
 	struct of_dma	*ofdma;
-	int		nbcells;
+	int		nbcells = 0;
 
 	if (!np || !of_dma_xlate) {
 		pr_err("%s: not enough information provided\n", __func__);
@@ -103,13 +103,7 @@ int of_dma_controller_register(struct device_node *np,
 	if (!ofdma)
 		return -ENOMEM;
 
-	nbcells = be32_to_cpup(of_get_property(np, "#dma-cells", NULL));
-	if (!nbcells) {
-		pr_err("%s: #dma-cells property is missing or invalid\n",
-		       __func__);
-		kfree(ofdma);
-		return -EINVAL;
-	}
+        of_property_read_u32(np, "#dma-cells", &nbcells);
 
 	ofdma->of_node = np;
 	ofdma->of_dma_nbcells = nbcells;
Signature · 1 line
1.7.10.4
Acked-by
#3 lore raw
In reply to a message not in the archive
Quoted 3 lines · Rob Herring

From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>

For controllers with no requests/clients (memory to memory only), the

Looks like the changelog got truncated.

Quoted 16 lines
Cc Vinod Koul <[email protected]>
Cc Dan Williams <[email protected]>
Cc Grant Likely <grant.likely-s3s/[email protected]>
---
 Documentation/devicetree/bindings/dma/dma.txt |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/dma/dma.txt +0 -0
index 8f504e6..d388f06 100644
@@ -8,9 +8,10 @@ controller.
 * DMA controller
 
 Required property:

Documentation/devicetree/bindings/dma/dma.txt controller. · line 17

Quoted 10 lines
Documentation/devicetree/bindings/dma/dma.txt +4 -3
-- #dma-cells: 		Must be at least 1. Used to provide DMA controller
-			specific information. See DMA client binding below for
-			more details.
+- #dma-cells: 		Required for controllers with requests. Optional for
+			memory to memory only DMA controllers. Must be at least
+			1. Used to provide DMA controller specific information. 
+			See DMA client binding below for more details.
 
 Optional properties:
 - dma-channels: 	Number of DMA channels supported by the controller.

Otherwise ...

Cheers
Jon

#5 lore raw
In reply to a message not in the archive
Quoted 7 lines · Jon Hunter
Quoted 3 lines · Rob Herring

From: Rob Herring <rob.herring-bsGFqQB8/[email protected]>

For controllers with no requests/clients (memory to memory only), the

Looks like the changelog got truncated.

By the way, may be this was in your original changelog, but I am curious what information the DMA client node in this case? Is it just the dma controller?

Cheers
Jon

#6 lore raw
In reply to Rob Herring
Quoted 3 lines · Rob Herring

From: Rob Herring <[email protected]>

For controllers with no requests/clients (memory to memory only), the

Change log is truncated...

Quoted 30 lines
Cc Vinod Koul <[email protected]>
Cc Dan Williams <[email protected]>
Cc Grant Likely <[email protected]>
---
 Documentation/devicetree/bindings/dma/dma.txt |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/dma/dma.txt +4 -3
index 8f504e6..d388f06 100644
@@ -8,9 +8,10 @@ controller.
 * DMA controller
 
 Required property:
-- #dma-cells: 		Must be at least 1. Used to provide DMA controller
-			specific information. See DMA client binding below for
-			more details.
+- #dma-cells: 		Required for controllers with requests. Optional for
+			memory to memory only DMA controllers. Must be at least
+			1. Used to provide DMA controller specific information. 
+			See DMA client binding below for more details.
 
 Optional properties:
 - dma-channels: 	Number of DMA channels supported by the controller.
Signature · 1 line
1.7.10.4