# 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 
- List: netdev
- Page: https://ratatoskr.run/netdev/2026/05/9010376
- Thread: https://ratatoskr.run/netdev/2026/05/9010164/t.md

```text
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

> ---
> 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,

```
