net: dsa: of: Allow ethernet-ports as encapsulating node
authorKurt Kanzenbach <kurt@linutronix.de>
Mon, 20 Jul 2020 12:49:39 +0000 (14:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Jul 2020 23:56:43 +0000 (16:56 -0700)
Due to unified Ethernet Switch Device Tree Bindings allow for ethernet-ports as
encapsulating node as well.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c

index e055eff..c0ffc7a 100644 (file)
@@ -727,8 +727,12 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
 
        ports = of_get_child_by_name(dn, "ports");
        if (!ports) {
-               dev_err(ds->dev, "no ports child node found\n");
-               return -EINVAL;
+               /* The second possibility is "ethernet-ports" */
+               ports = of_get_child_by_name(dn, "ethernet-ports");
+               if (!ports) {
+                       dev_err(ds->dev, "no ports child node found\n");
+                       return -EINVAL;
+               }
        }
 
        for_each_available_child_of_node(ports, port) {