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

Maxime Chevallier <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.network,gmane.linux.kernel.janitors
Message-ID <[email protected]>
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 <[email protected]>

Reviewed-by: Maxime Chevallier <[email protected]>

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,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.