Netdev List
 help / color / mirror / Atom feed
* [PATCH 0/3] net: phy: micrel: Code clean-up
@ 2026-05-15 14:50 Christophe JAILLET
  2026-05-15 14:50 ` [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code Christophe JAILLET
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Christophe JAILLET @ 2026-05-15 14:50 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

This serie is only some clean-up related to
drivers/net/mdio/mdio-mscc-miim.c

It depends on a patch called "[PATCH net-next] net: phy: micrel: use dev_err_probe()"
that has been sent recently.

Note that in the 2nd patch, the order of the calls in the remove
function is changed. I don't think that it matters, but I'm always
relunctent to change such things.

The patches are compile tested only.

Christophe JAILLET (3):
  net: mdio: mscc-miim: Remove some redundant code
  net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
  net: mdio: mscc-miim: Use devm_of_mdiobus_register()

 drivers/net/mdio/mdio-mscc-miim.c | 34 +++++--------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)

-- 
2.54.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code
  2026-05-15 14:50 [PATCH 0/3] net: phy: micrel: Code clean-up Christophe JAILLET
@ 2026-05-15 14:50 ` Christophe JAILLET
  2026-05-15 15:45   ` Maxime Chevallier
  2026-05-15 14:50 ` [PATCH 2/3 net-next] net: mdio: mscc-miim: Use devm_clk_get_optional_enabled() Christophe JAILLET
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Christophe JAILLET @ 2026-05-15 14:50 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

*pbus is assign twice with the same value. Remove one of the redundant
assignment.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/mdio/mdio-mscc-miim.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
index 259944d37fbd..03878bd9091d 100644
--- a/drivers/net/mdio/mdio-mscc-miim.c
+++ b/drivers/net/mdio/mdio-mscc-miim.c
@@ -233,8 +233,6 @@ int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
 
 	miim = bus->priv;
 
-	*pbus = bus;
-
 	miim->regs = mii_regmap;
 	miim->mii_status_offset = status_offset;
 	miim->ignore_read_errors = ignore_read_errors;
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3 net-next] net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
  2026-05-15 14:50 [PATCH 0/3] net: phy: micrel: Code clean-up Christophe JAILLET
  2026-05-15 14:50 ` [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code Christophe JAILLET
@ 2026-05-15 14:50 ` Christophe JAILLET
  2026-05-15 15:53   ` Maxime Chevallier
  2026-05-15 14:50 ` [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register() Christophe JAILLET
  2026-05-19  0:15 ` [PATCH 0/3] net: phy: micrel: Code clean-up Jakub Kicinski
  3 siblings, 1 reply; 9+ messages in thread
From: Christophe JAILLET @ 2026-05-15 14:50 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

Use devm_clk_get_optional_enabled() instead of clk_prepare_enable() and
clk_disable_unprepare().

This saves some lines of code and simplifies error handling in the probe.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.

In the remove sequence, clk_disable_unprepare() and mdiobus_unregister()
are not called with the same order anymore. I don't think that it matters.
---
 drivers/net/mdio/mdio-mscc-miim.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
index 03878bd9091d..4d8f60d458b8 100644
--- a/drivers/net/mdio/mdio-mscc-miim.c
+++ b/drivers/net/mdio/mdio-mscc-miim.c
@@ -307,7 +307,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
 	if (!miim->info)
 		return -EINVAL;
 
-	miim->clk = devm_clk_get_optional(dev, NULL);
+	miim->clk = devm_clk_get_optional_enabled(dev, NULL);
 	if (IS_ERR(miim->clk))
 		return PTR_ERR(miim->clk);
 
@@ -318,35 +318,23 @@ static int mscc_miim_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	ret = clk_prepare_enable(miim->clk);
-	if (ret)
-		return ret;
-
 	ret = mscc_miim_clk_set(bus);
 	if (ret)
-		goto out_disable_clk;
+		return ret;
 
 	ret = of_mdiobus_register(bus, np);
-	if (ret < 0) {
-		dev_err_probe(dev, ret, "Cannot register MDIO bus\n");
-		goto out_disable_clk;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Cannot register MDIO bus\n");
 
 	platform_set_drvdata(pdev, bus);
 
 	return 0;
-
-out_disable_clk:
-	clk_disable_unprepare(miim->clk);
-	return ret;
 }
 
 static void mscc_miim_remove(struct platform_device *pdev)
 {
 	struct mii_bus *bus = platform_get_drvdata(pdev);
-	struct mscc_miim_dev *miim = bus->priv;
 
-	clk_disable_unprepare(miim->clk);
 	mdiobus_unregister(bus);
 }
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register()
  2026-05-15 14:50 [PATCH 0/3] net: phy: micrel: Code clean-up Christophe JAILLET
  2026-05-15 14:50 ` [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code Christophe JAILLET
  2026-05-15 14:50 ` [PATCH 2/3 net-next] net: mdio: mscc-miim: Use devm_clk_get_optional_enabled() Christophe JAILLET
@ 2026-05-15 14:50 ` Christophe JAILLET
  2026-05-15 15:54   ` Maxime Chevallier
  2026-05-19  0:15 ` [PATCH 0/3] net: phy: micrel: Code clean-up Jakub Kicinski
  3 siblings, 1 reply; 9+ messages in thread
From: Christophe JAILLET @ 2026-05-15 14:50 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

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 <christophe.jaillet@wanadoo.fr>
---
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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code
  2026-05-15 14:50 ` [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code Christophe JAILLET
@ 2026-05-15 15:45   ` Maxime Chevallier
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Chevallier @ 2026-05-15 15:45 UTC (permalink / raw)
  To: Christophe JAILLET, andrew, hkallweit1, linux, davem, edumazet,
	kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors

Hi,

On 5/15/26 16:50, Christophe JAILLET wrote:
> *pbus is assign twice with the same value. Remove one of the redundant
> assignment.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

> ---
>   drivers/net/mdio/mdio-mscc-miim.c | 2 --
>   1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
> index 259944d37fbd..03878bd9091d 100644
> --- a/drivers/net/mdio/mdio-mscc-miim.c
> +++ b/drivers/net/mdio/mdio-mscc-miim.c
> @@ -233,8 +233,6 @@ int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
>   
>   	miim = bus->priv;
>   
> -	*pbus = bus;
> -
>   	miim->regs = mii_regmap;
>   	miim->mii_status_offset = status_offset;
>   	miim->ignore_read_errors = ignore_read_errors;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3 net-next] net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
  2026-05-15 14:50 ` [PATCH 2/3 net-next] net: mdio: mscc-miim: Use devm_clk_get_optional_enabled() Christophe JAILLET
@ 2026-05-15 15:53   ` Maxime Chevallier
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Chevallier @ 2026-05-15 15:53 UTC (permalink / raw)
  To: Christophe JAILLET, andrew, hkallweit1, linux, davem, edumazet,
	kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors

Hi,

On 5/15/26 16:50, Christophe JAILLET wrote:
> Use devm_clk_get_optional_enabled() instead of clk_prepare_enable() and
> clk_disable_unprepare().
> 
> This saves some lines of code and simplifies error handling in the probe.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested only.
> 
> In the remove sequence, clk_disable_unprepare() and mdiobus_unregister()
> are not called with the same order anymore. I don't think that it matters.

If anything, I'd say this is better as the original ordering, as the 
remove path now mirrors the probe one.

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

> ---
>   drivers/net/mdio/mdio-mscc-miim.c | 20 ++++----------------
>   1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/net/mdio/mdio-mscc-miim.c b/drivers/net/mdio/mdio-mscc-miim.c
> index 03878bd9091d..4d8f60d458b8 100644
> --- a/drivers/net/mdio/mdio-mscc-miim.c
> +++ b/drivers/net/mdio/mdio-mscc-miim.c
> @@ -307,7 +307,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
>   	if (!miim->info)
>   		return -EINVAL;
>   
> -	miim->clk = devm_clk_get_optional(dev, NULL);
> +	miim->clk = devm_clk_get_optional_enabled(dev, NULL);
>   	if (IS_ERR(miim->clk))
>   		return PTR_ERR(miim->clk);
>   
> @@ -318,35 +318,23 @@ static int mscc_miim_probe(struct platform_device *pdev)
>   		return -EINVAL;
>   	}
>   
> -	ret = clk_prepare_enable(miim->clk);
> -	if (ret)
> -		return ret;
> -
>   	ret = mscc_miim_clk_set(bus);
>   	if (ret)
> -		goto out_disable_clk;
> +		return ret;
>   
>   	ret = of_mdiobus_register(bus, np);
> -	if (ret < 0) {
> -		dev_err_probe(dev, ret, "Cannot register MDIO bus\n");
> -		goto out_disable_clk;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "Cannot register MDIO bus\n");
>   
>   	platform_set_drvdata(pdev, bus);
>   
>   	return 0;
> -
> -out_disable_clk:
> -	clk_disable_unprepare(miim->clk);
> -	return ret;
>   }
>   
>   static void mscc_miim_remove(struct platform_device *pdev)
>   {
>   	struct mii_bus *bus = platform_get_drvdata(pdev);
> -	struct mscc_miim_dev *miim = bus->priv;
>   
> -	clk_disable_unprepare(miim->clk);
>   	mdiobus_unregister(bus);
>   }
>   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register()
  2026-05-15 14:50 ` [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register() Christophe JAILLET
@ 2026-05-15 15:54   ` Maxime Chevallier
  0 siblings, 0 replies; 9+ messages in thread
From: Maxime Chevallier @ 2026-05-15 15:54 UTC (permalink / raw)
  To: Christophe JAILLET, andrew, hkallweit1, linux, davem, edumazet,
	kuba, pabeni
  Cc: netdev, linux-kernel, kernel-janitors

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 <christophe.jaillet@wanadoo.fr>

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,


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] net: phy: micrel: Code clean-up
  2026-05-15 14:50 [PATCH 0/3] net: phy: micrel: Code clean-up Christophe JAILLET
                   ` (2 preceding siblings ...)
  2026-05-15 14:50 ` [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register() Christophe JAILLET
@ 2026-05-19  0:15 ` Jakub Kicinski
  2026-05-19  0:17   ` Jakub Kicinski
  3 siblings, 1 reply; 9+ messages in thread
From: Jakub Kicinski @ 2026-05-19  0:15 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: andrew, hkallweit1, linux, davem, edumazet, pabeni, netdev,
	linux-kernel, kernel-janitors

On Fri, 15 May 2026 16:50:23 +0200 Christophe JAILLET wrote:
> This serie is only some clean-up related to
> drivers/net/mdio/mdio-mscc-miim.c
> 
> It depends on a patch called "[PATCH net-next] net: phy: micrel: use dev_err_probe()"
> that has been sent recently.
> 
> Note that in the 2nd patch, the order of the calls in the remove
> function is changed. I don't think that it matters, but I'm always
> relunctent to change such things.
> 
> The patches are compile tested only.

... against the wrong base tree I suspect? :S

Applying: net: mdio: mscc-miim: Remove some redundant code
Applying: net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
error: patch failed: drivers/net/mdio/mdio-mscc-miim.c:318
error: drivers/net/mdio/mdio-mscc-miim.c: patch does not apply
Patch failed at 0002 net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
hint: Use 'git am --show-current-patch=diff' to see the failed patch
-- 
pw-bot: cr

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] net: phy: micrel: Code clean-up
  2026-05-19  0:15 ` [PATCH 0/3] net: phy: micrel: Code clean-up Jakub Kicinski
@ 2026-05-19  0:17   ` Jakub Kicinski
  0 siblings, 0 replies; 9+ messages in thread
From: Jakub Kicinski @ 2026-05-19  0:17 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: andrew, hkallweit1, linux, davem, edumazet, pabeni, netdev,
	linux-kernel, kernel-janitors

On Mon, 18 May 2026 17:15:51 -0700 Jakub Kicinski wrote:
> On Fri, 15 May 2026 16:50:23 +0200 Christophe JAILLET wrote:
> > This serie is only some clean-up related to
> > drivers/net/mdio/mdio-mscc-miim.c
> > 
> > It depends on a patch called "[PATCH net-next] net: phy: micrel: use dev_err_probe()"
> > that has been sent recently.

Oh, missed this of course. No auto-tester will get this sort of note.
Posting patches with dependencies is not "supported".
I've have expected you to know better..

> > Note that in the 2nd patch, the order of the calls in the remove
> > function is changed. I don't think that it matters, but I'm always
> > relunctent to change such things.
> > 
> > The patches are compile tested only.  
> 
> ... against the wrong base tree I suspect? :S
> 
> Applying: net: mdio: mscc-miim: Remove some redundant code
> Applying: net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
> error: patch failed: drivers/net/mdio/mdio-mscc-miim.c:318
> error: drivers/net/mdio/mdio-mscc-miim.c: patch does not apply
> Patch failed at 0002 net: mdio: mscc-miim: Use devm_clk_get_optional_enabled()
> hint: Use 'git am --show-current-patch=diff' to see the failed patch


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-05-19  0:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-15 14:50 [PATCH 0/3] net: phy: micrel: Code clean-up Christophe JAILLET
2026-05-15 14:50 ` [PATCH 1/3 net-next] net: mdio: mscc-miim: Remove some redundant code Christophe JAILLET
2026-05-15 15:45   ` Maxime Chevallier
2026-05-15 14:50 ` [PATCH 2/3 net-next] net: mdio: mscc-miim: Use devm_clk_get_optional_enabled() Christophe JAILLET
2026-05-15 15:53   ` Maxime Chevallier
2026-05-15 14:50 ` [PATCH 3/3 net-next] net: mdio: mscc-miim: Use devm_of_mdiobus_register() Christophe JAILLET
2026-05-15 15:54   ` Maxime Chevallier
2026-05-19  0:15 ` [PATCH 0/3] net: phy: micrel: Code clean-up Jakub Kicinski
2026-05-19  0:17   ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox