[PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register()
Christophe JAILLET <[email protected]>
| Newsgroups | gmane.linux.kernel.janitors,gmane.linux.network,gmane.linux.kernel |
|---|---|
| Message-ID | <139ebd0e3698de5e785bb0c70a4d4da43925a7ae.1778856199.git.christophe.jaillet@wanadoo.fr> |
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 <[email protected]> --- 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, -- 2.54.0