Re: [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register()

From
Maxime Chevallier <maxime.chevallier@bootlin.com>
Date
2026-05-15 15:54:06
Also in
kernel-janitors, lkml
Reply to
Christophe JAILLET, 2026-05-15
Hi,

On 5/15/26 16:50, Christophe JAILLET wrote:
Use devm_of_mdiobus_register() instead of hand writing it.
This saves some lines of code.

The remove function can be removed completely and the
platform_set_drvdata() call at the end of the probe is now also useless and
can be removed as-well.

Signed-off-by: Christophe JAILLET <redacted>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime
quoted hunk ↗ jump to hunk
---
Compile tested only.
---
  drivers/net/mdio/mdio-mscc-miim.c | 12 +-----------
  1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
index 4d8f60d458b8..7bdcf3e9baa0 100644
--- a/drivers/net/mdio/mdio-mscc-miim.c
+++ b/drivers/net/mdio/mdio-mscc-miim.c
@@ -322,22 +322,13 @@ static int mscc_miim_probe(struct platform_device *pdev)
  	if (ret)
  		return ret;
  
-	ret = of_mdiobus_register(bus, np);
+	ret = devm_of_mdiobus_register(dev, bus, np);
  	if (ret < 0)
  		return dev_err_probe(dev, ret, "Cannot register MDIO bus\n");
  
-	platform_set_drvdata(pdev, bus);
-
  	return 0;
  }
  
-static void mscc_miim_remove(struct platform_device *pdev)
-{
-	struct mii_bus *bus = platform_get_drvdata(pdev);
-
-	mdiobus_unregister(bus);
-}
-
  static const struct mscc_miim_info mscc_ocelot_miim_info = {
  	.phy_reset_offset = MSCC_PHY_REG_PHY_CFG,
  	.phy_reset_bits = PHY_CFG_PHY_ENA | PHY_CFG_PHY_COMMON_RESET |
@@ -363,7 +354,6 @@ MODULE_DEVICE_TABLE(of, mscc_miim_match);
  
  static struct platform_driver mscc_miim_driver = {
  	.probe = mscc_miim_probe,
-	.remove = mscc_miim_remove,
  	.driver = {
  		.name = "mscc-miim",
  		.of_match_table = mscc_miim_match,
  
Thread (9 messages) 9 messages, 3 authors, last reply 2026-05-19
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help