Skip to contentSkip to conversation

net: dsa: felix: Don't error out on disabled ports with no phy-mode

PATCH In review Vladimir Oltean 2 participants 2 messages Jan 16, 2020

Subsystems (4)
lore
Share & tools
lore

Vladimir Oltean

author maintainer
#0 lore raw

PATCH 1/1 net: dsa: felix: Don't error out on disabled ports with no phy-mode

From: Vladimir Oltean <[email protected]>

The felix_parse_ports_node function was tested only on device trees where all ports were enabled. Fix this check so that the driver continues to probe only with the ports where status is not "disabled", as expected.

Fixes bdeced75b13f ("net: dsa: felix: Add PCS operations for PHYLINK")
---
 drivers/net/dsa/ocelot/felix.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/dsa/ocelot/felix.c +3 -0
index feccb6201660..d6ee089dbfe1 100644
@@ -328,6 +328,9 @@ static int felix_parse_ports_node(struct felix *felix,
 		u32 port;
 		int err;
 
+		if (!of_device_is_available(child))
+			continue;
+
 		/* Get switch port number from DT */
 		if (of_property_read_u32(child, "reg", &port) < 0) {
 			dev_err(dev, "Port number not defined in device tree "
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 18 lines · Vladimir Oltean

From: Vladimir Oltean <[email protected]>

The felix_parse_ports_node function was tested only on device trees where all ports were enabled. Fix this check so that the driver continues to probe only with the ports where status is not "disabled", as expected.

Fixes bdeced75b13f ("net: dsa: felix: Add PCS operations for PHYLINK")
---
 drivers/net/dsa/ocelot/felix.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/dsa/ocelot/felix.c +0 -0
index feccb6201660..d6ee089dbfe1 100644

drivers/net/dsa/ocelot/felix.c static int felix_parse_ports_node(struct felix *felix, · line 333

Quoted 6 lines
drivers/net/dsa/ocelot/felix.c +3 -0
@@ -328,6 +328,9 @@ static int felix_parse_ports_node(struct felix *felix,
 		u32 port;
 		int err;
 
+		if (!of_device_is_available(child))
+			continue;
+

Hi Vladimir

for_each_available_child_of_node() is i think a better fix.

Andrew