Skip to content

Commit ab3b361

Browse files
author
Vince Bridgers
committed
FogBugz #189738: Correct code to obtain mdio child node from devicetree
The code to obtain the mdio child node accidentally worked for the devicetree used for testing, and was incorrect for arbitrary devicetrees. This patch corrects that problem found during community review. Signed-off-by: Vince Bridgers <[email protected]>
1 parent 46550cf commit ab3b361

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/net/ethernet/altera/altera_tse_main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,16 @@ static int altera_tse_mdio_create(struct net_device *dev, unsigned int id)
129129
struct altera_tse_private *priv = netdev_priv(dev);
130130
int ret;
131131
int i;
132-
struct device_node *mdio_node;
133-
struct mii_bus *mdio;
132+
struct device_node *mdio_node = NULL;
133+
struct mii_bus *mdio = NULL;
134+
struct device_node *child_node = NULL;
134135

135-
mdio_node = of_find_compatible_node(priv->device->of_node, NULL,
136-
"altr,tse-mdio");
136+
for_each_child_of_node(priv->device->of_node, child_node) {
137+
if (of_device_is_compatible(child_node, "altr,tse-mdio")) {
138+
mdio_node = child_node;
139+
break;
140+
}
141+
}
137142

138143
if (mdio_node) {
139144
dev_dbg(priv->device, "FOUND MDIO subnode\n");

0 commit comments

Comments
 (0)