Skip to contentSkip to conversation

net: marvell: mvmdio: use clk_get_optional

PATCH Applied Rosen Penev 3 participants 3 messages Sep 30, 2024 – Oct 4, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: marvell: mvmdio: use clk_get_optional

The code seems to be handling EPROBE_DEFER explicitly and if there's no error, enables the clock. clk_get_optional exists for that.

---
 drivers/net/ethernet/marvell/mvmdio.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/net/ethernet/marvell/mvmdio.c +4 -7
index e1d003fdbc2e..67378e9f538a 100644
@@ -348,13 +348,12 @@ static int orion_mdio_probe(struct platform_device *pdev)
 		if (type == BUS_TYPE_XSMI)
 			orion_mdio_xsmi_set_mdc_freq(bus);
 	} else {
-		dev->clk[0] = clk_get(&pdev->dev, NULL);
-		if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) {
-			ret = -EPROBE_DEFER;
+		dev->clk[0] = clk_get_optional(&pdev->dev, NULL);
+		if (IS_ERR(dev->clk[0])) {
+			ret = PTR_ERR(dev->clk[0]);
 			goto out_clk;
 		}
-		if (!IS_ERR(dev->clk[0]))
-			clk_prepare_enable(dev->clk[0]);
+		clk_prepare_enable(dev->clk[0]);
 	}
 
 
@@ -422,8 +421,6 @@ static void orion_mdio_remove(struct platform_device *pdev)
 	mdiobus_unregister(bus);
 
 	for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
-		if (IS_ERR(dev->clk[i]))
-			break;
 		clk_disable_unprepare(dev->clk[i]);
 		clk_put(dev->clk[i]);
 	}
Signature · 1 line
2.46.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 2 lines · Rosen Penev

The code seems to be handling EPROBE_DEFER explicitly and if there's no error, enables the clock. clk_get_optional exists for that.

Andrew

#2 lore raw
In reply to Rosen Penev
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 7 lines · On Mon, 30 Sep 2024 14:16:28 -0700 you wrote:

The code seems to be handling EPROBE_DEFER explicitly and if there's no error, enables the clock. clk_get_optional exists for that.

---
 drivers/net/ethernet/marvell/mvmdio.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

Here is the summary with links:
- [net-next] net: marvell: mvmdio: use clk_get_optional

    https://git.kernel.org/netdev/net-next/c/4c5107b8f508

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html