Skip to content

Commit 03377e3

Browse files
isubramadavem330
authored andcommitted
drivers: net: xgene: Fix backward compatibility
This patch fixes the backward compatibility on handling phy_connect(), by iterating over the phy-handle, when new DT is used with older kernel. Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c50fc26 commit 03377e3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/net/ethernet/apm/xgene/xgene_enet_hw.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -761,18 +761,18 @@ int xgene_enet_phy_connect(struct net_device *ndev)
761761
if (dev->of_node) {
762762
for (i = 0 ; i < 2; i++) {
763763
np = of_parse_phandle(dev->of_node, "phy-handle", i);
764-
if (np)
765-
break;
766-
}
767764

768-
if (!np) {
769-
netdev_dbg(ndev, "No phy-handle found in DT\n");
770-
return -ENODEV;
765+
if (!np)
766+
continue;
767+
768+
phy_dev = of_phy_connect(ndev, np,
769+
&xgene_enet_adjust_link,
770+
0, pdata->phy_mode);
771+
of_node_put(np);
772+
if (phy_dev)
773+
break;
771774
}
772775

773-
phy_dev = of_phy_connect(ndev, np, &xgene_enet_adjust_link,
774-
0, pdata->phy_mode);
775-
of_node_put(np);
776776
if (!phy_dev) {
777777
netdev_err(ndev, "Could not connect to PHY\n");
778778
return -ENODEV;

0 commit comments

Comments
 (0)