Skip to contentSkip to conversation

checks: Allow PCI bridge child nodes without an address

PATCH In review Rob Herring 2 participants 4 messages Sep 28, 2020 – Oct 2, 2020 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 checks: Allow PCI bridge child nodes without an address

Some PCI bridge nodes have child nodes such as an interrupt controller which are not PCI devices. Allow these nodes which don't have a unit-address.

---
 checks.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
checks.c +1 -3
index b7955dbd71ca..17cb6890d45a 100644
@@ -891,10 +891,8 @@ static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct no
 		return;
 
 	prop = get_property(node, "reg");
-	if (!prop) {
-		FAIL(c, dti, node, "missing PCI reg property");
+	if (!prop)
 		return;
-	}
 
 	cells = (cell_t *)prop->val.val;
 	if (cells[1] || cells[2])
Signature · 1 line
2.25.1

A message that is not in the archive (sent off-list or not yet received): 20200928201942.3242124-1-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#2 lore raw

PATCH 2/2 checks: Relax SPI slave checks

SPI slaves only have a single child node and therefore don't need '#address-cells' nor '#size-cells', so let's skip the check for those when 'spi-slave' is present.

---
 checks.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
checks.c +6 -7
index 17cb6890d45a..c923295c6e40 100644
@@ -1102,13 +1102,12 @@ static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct no
 	if (node->bus != &spi_bus || !node->children)
 		return;
 
-	if (get_property(node, "spi-slave"))
-		spi_addr_cells = 0;
-	if (node_addr_cells(node) != spi_addr_cells)
-		FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
-	if (node_size_cells(node) != 0)
-		FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
-
+	if (!get_property(node, "spi-slave")) {
+		if (node_addr_cells(node) != spi_addr_cells)
+			FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
+		if (node_size_cells(node) != 0)
+			FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
+	}
 }
 WARNING(spi_bus_bridge, check_spi_bus_bridge, NULL, &addr_size_cells);
 
Signature · 1 line
2.25.1

A message that is not in the archive (sent off-list or not yet received): 20200928201942.3242124-2-robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#4 lore raw

Re: [PATCH 2/2] checks: Relax SPI slave checks

Quoted 3 lines · Rob Herring

SPI slaves only have a single child node and therefore don't need '#address-cells' nor '#size-cells', so let's skip the check for those when 'spi-slave' is present.

I really don't like this idea. Yes, you can work out what's going on unambiguously because there's only one child, but that requires at least some familiarity with SPI. I think general consistency trumps minimality here, and we should encourage SPI nodes to have the correct -cells properties, even if they're not strictly essential.

Quoted 31 lines
---
 checks.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
checks.c +6 -7
index 17cb6890d45a..c923295c6e40 100644
@@ -1102,13 +1102,12 @@ static void check_spi_bus_bridge(struct check *c, struct dt_info *dti, struct no
 	if (node->bus != &spi_bus || !node->children)
 		return;
 
-	if (get_property(node, "spi-slave"))
-		spi_addr_cells = 0;
-	if (node_addr_cells(node) != spi_addr_cells)
-		FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
-	if (node_size_cells(node) != 0)
-		FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
-
+	if (!get_property(node, "spi-slave")) {
+		if (node_addr_cells(node) != spi_addr_cells)
+			FAIL(c, dti, node, "incorrect #address-cells for SPI bus");
+		if (node_size_cells(node) != 0)
+			FAIL(c, dti, node, "incorrect #size-cells for SPI bus");
+	}
 }
 WARNING(spi_bus_bridge, check_spi_bus_bridge, NULL, &addr_size_cells);
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#5 lore raw
In reply to a message not in the archive
Quoted 5 lines · Rob Herring

Some PCI bridge nodes have child nodes such as an interrupt controller which are not PCI devices. Allow these nodes which don't have a unit-address.

I suspect doing that isn't really IEEE1275-ly correct, but I can see how that would be convenient. Applied.

Quoted 20 lines
---
 checks.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
checks.c +1 -3
index b7955dbd71ca..17cb6890d45a 100644
@@ -891,10 +891,8 @@ static void check_pci_device_reg(struct check *c, struct dt_info *dti, struct no
 		return;
 
 	prop = get_property(node, "reg");
-	if (!prop) {
-		FAIL(c, dti, node, "missing PCI reg property");
+	if (!prop)
 		return;
-	}
 
 	cells = (cell_t *)prop->val.val;
 	if (cells[1] || cells[2])
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson