summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/apm/xgene
diff options
context:
space:
mode:
authorIyappan Subramanian <isubramanian@apm.com>2016-08-12 22:05:47 -0700
committerDavid S. Miller <davem@davemloft.net>2016-08-13 11:48:53 -0700
commit03377e381bf48d7aaa797577789551b04bce7006 (patch)
treefb44cdf7c42f0dc50cf66b2086847909e450e1ad /drivers/net/ethernet/apm/xgene
parentc50fc2622cbce4341daf40a4e7ad3f1625c9e55c (diff)
downloadlinux-03377e381bf48d7aaa797577789551b04bce7006.tar.bz2
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>
Diffstat (limited to 'drivers/net/ethernet/apm/xgene')
-rw-r--r--drivers/net/ethernet/apm/xgene/xgene_enet_hw.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 18bb9556dd00..321fb197621e 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -761,18 +761,18 @@ int xgene_enet_phy_connect(struct net_device *ndev)
if (dev->of_node) {
for (i = 0 ; i < 2; i++) {
np = of_parse_phandle(dev->of_node, "phy-handle", i);
- if (np)
- break;
- }
- if (!np) {
- netdev_dbg(ndev, "No phy-handle found in DT\n");
- return -ENODEV;
+ if (!np)
+ continue;
+
+ phy_dev = of_phy_connect(ndev, np,
+ &xgene_enet_adjust_link,
+ 0, pdata->phy_mode);
+ of_node_put(np);
+ if (phy_dev)
+ break;
}
- phy_dev = of_phy_connect(ndev, np, &xgene_enet_adjust_link,
- 0, pdata->phy_mode);
- of_node_put(np);
if (!phy_dev) {
netdev_err(ndev, "Could not connect to PHY\n");
return -ENODEV;