Skip to contentSkip to conversation

dsa: correctly determine the number of switches in a system

PATCH Applied Tobias Waldekranz 3 participants 3 messages Feb 5, 2015 – Feb 8, 2015

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

PATCH 1/1 dsa: correctly determine the number of switches in a system

The number of connected switches was sourced from the number of children to the DSA node, change it to the number of available children, skipping any disabled switches.

---
 net/dsa/dsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/dsa.c +1 -1
index 3731714..2173402 100644
@@ -603,7 +603,7 @@ static int dsa_of_probe(struct platform_device *pdev)
 
 	pdev->dev.platform_data = pd;
 	pd->netdev = &ethernet_dev->dev;
-	pd->nr_chips = of_get_child_count(np);
+	pd->nr_chips = of_get_available_child_count(np);
 	if (pd->nr_chips > DSA_MAX_SWITCHES)
 		pd->nr_chips = DSA_MAX_SWITCHES;
 
Signature · 1 line
1.8.4.357.g8d83871.dirty
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Tobias Waldekranz

The number of connected switches was sourced from the number of children to the DSA node, change it to the number of available children, skipping any disabled switches.

Fixes 5e95329b701c4 ("dsa: add device tree bindings to register DSA

switches")

Quoted 18 lines
---
 net/dsa/dsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/dsa/dsa.c +1 -1
index 3731714..2173402 100644
@@ -603,7 +603,7 @@ static int dsa_of_probe(struct platform_device *pdev)
 
 	pdev->dev.platform_data = pd;
 	pd->netdev = &ethernet_dev->dev;
-	pd->nr_chips = of_get_child_count(np);
+	pd->nr_chips = of_get_available_child_count(np);
 	if (pd->nr_chips > DSA_MAX_SWITCHES)
 		pd->nr_chips = DSA_MAX_SWITCHES;
 
Signature · 1 line
Florian