From: Tobias Waldekranz Date: Thu, 5 Feb 2015 13:54:09 +0000 (+0100) Subject: dsa: correctly determine the number of switches in a system X-Git-Tag: v4.14-rc1~5989^2~3^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e04449fcf2cd63dec176355a028bd28b4d469be9;p=platform%2Fkernel%2Flinux-rpi.git 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. Fixes: 5e95329b701c4 ("dsa: add device tree bindings to register DSA switches") Signed-off-by: Tobias Waldekranz Acked-by: Florian Fainelli Signed-off-by: David S. Miller --- diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 3731714..2173402 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -603,7 +603,7 @@ static int dsa_of_probe(struct platform_device *pdev) pdev->dev.platform_data = pd; pd->netdev = ðernet_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;