Skip to contentSkip to conversation

stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS

PATCH Applied Romain Perier 3 participants 3 messages Jan 7, 2016 – Jan 10, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 stmmac: Don't exit mdio registration when mdio subnode is not found in the DTS

Originally, most of the platforms using this driver did not define an mdio subnode in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver") introduced a backward compatibily issue by using of_mdiobus_register explicitly with an mdio subnode. This patch fixes the issue by calling the function mdiobus_register, when mdio subnode is not found. The driver is now compatible with both modes.

Fixes e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver")

---

Changes in v2:
- Removed IS_ENABLED macro from the if statement before calling of_mdiobus_register.
- Added Fixes tag in commit message

 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +5 -3
index 16c85cc..648488d 100644
@@ -218,8 +218,7 @@ int stmmac_mdio_register(struct net_device *ndev)
 		if (mdio_node) {
 			netdev_dbg(ndev, "FOUND MDIO subnode\n");
 		} else {
-			netdev_err(ndev, "NO MDIO subnode\n");
-			return 0;
+			netdev_warn(ndev, "No MDIO subnode found\n");
 		}
 	}
 
@@ -251,7 +250,10 @@ int stmmac_mdio_register(struct net_device *ndev)
 	new_bus->phy_mask = mdio_bus_data->phy_mask;
 	new_bus->parent = priv->device;
 
-	err = of_mdiobus_register(new_bus, mdio_node);
+	if (mdio_node)
+		err = of_mdiobus_register(new_bus, mdio_node);
+	else
+		err = mdiobus_register(new_bus);
 	if (err != 0) {
 		pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
 		goto bus_register_fail;
Signature · 1 line
2.5.0
Tested-by on v2 1/1
#1 lore raw
Quoted 36 lines · Romain Perier

Originally, most of the platforms using this driver did not define an mdio subnode in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver") introduced a backward compatibily issue by using of_mdiobus_register explicitly with an mdio subnode. This patch fixes the issue by calling the function mdiobus_register, when mdio subnode is not found. The driver is now compatible with both modes.

Fixes e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver")

---

Changes in v2:
- Removed IS_ENABLED macro from the if statement before calling of_mdiobus_register.
- Added Fixes tag in commit message

  drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +1 -2
index 16c85cc..648488d 100644
@@ -218,8 +218,7 @@ int stmmac_mdio_register(struct net_device *ndev)
  		if (mdio_node) {
  			netdev_dbg(ndev, "FOUND MDIO subnode\n");
  		} else {
-			netdev_err(ndev, "NO MDIO subnode\n");
-			return 0;
+			netdev_warn(ndev, "No MDIO subnode found\n");
  		}
  	}
 
@@ -251,7 +250,10 @@ int stmmac_mdio_register(struct net_device *ndev)
  	new_bus->phy_mask = mdio_bus_data->phy_mask;

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c int stmmac_mdio_register(struct net_device *ndev) · line 259

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +4 -1
  	new_bus->parent = priv->device;
 
-	err = of_mdiobus_register(new_bus, mdio_node);
+	if (mdio_node)
+		err = of_mdiobus_register(new_bus, mdio_node);
+	else
+		err = mdiobus_register(new_bus);
  	if (err != 0) {
  		pr_err("%s: Cannot register as MDIO bus\n", new_bus->name);
  		goto bus_register_fail;
Signature · 2 lines
Regards
Phil Reid
maintainer Applied
#2 lore raw
In reply to Romain Perier

From: Romain Perier <[email protected]>
Date: Thu, 7 Jan 2016 21:13:28 +0100

Quoted 9 lines

Originally, most of the platforms using this driver did not define an mdio subnode in the devicetree. Commit e34d65 ("stmmac: create of compatible mdio bus for stmmac driver") introduced a backward compatibily issue by using of_mdiobus_register explicitly with an mdio subnode. This patch fixes the issue by calling the function mdiobus_register, when mdio subnode is not found. The driver is now compatible with both modes.

Fixes e34d65696d2e ("stmmac: create of compatible mdio bus for stmmac driver")

Applied, thanks.