]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
dsa: correctly determine the number of switches in a system
authorTobias Waldekranz <tobias@waldekranz.com>
Thu, 5 Feb 2015 13:54:09 +0000 (14:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 8 Feb 2015 06:07:37 +0000 (22:07 -0800)
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")
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa.c

index 37317149f9188f4ff6635015ecc486980053a7fa..2173402d87e0f56f255d0b378f06fc51aa2d3fed 100644 (file)
@@ -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;