[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240822084733.1599295-5-frank.li@vivo.com>
Date: Thu, 22 Aug 2024 02:47:28 -0600
From: Yangtao Li <frank.li@...o.com>
To: clement.leger@...tlin.com,
andrew@...n.ch,
f.fainelli@...il.com,
olteanv@...il.com,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
ulli.kroll@...glemail.com,
linus.walleij@...aro.org,
marcin.s.wojtas@...il.com,
linux@...linux.org.uk,
alexandre.torgue@...s.st.com,
joabreu@...opsys.com,
mcoquelin.stm32@...il.com,
hkallweit1@...il.com,
justinstitt@...gle.com,
kees@...nel.org,
u.kleine-koenig@...gutronix.de,
jacob.e.keller@...el.com,
horms@...nel.org,
shannon.nelson@....com
Cc: linux-renesas-soc@...r.kernel.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com,
Yangtao Li <frank.li@...o.com>
Subject: [net-next 4/9] net: mdio: hisi-femac: Convert to devm_clk_get_enabled()
Convert devm_clk_get(), clk_prepare_enable() to a single
call to devm_clk_get_enabled(), as this is exactly
what this function does.
Signed-off-by: Yangtao Li <frank.li@...o.com>
---
drivers/net/mdio/mdio-hisi-femac.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/drivers/net/mdio/mdio-hisi-femac.c b/drivers/net/mdio/mdio-hisi-femac.c
index 6703f626ee83..f6fcb9e11624 100644
--- a/drivers/net/mdio/mdio-hisi-femac.c
+++ b/drivers/net/mdio/mdio-hisi-femac.c
@@ -21,7 +21,6 @@
#define BIT_WR_DATA_OFFSET 16
struct hisi_femac_mdio_data {
- struct clk *clk;
void __iomem *membase;
};
@@ -74,6 +73,7 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct mii_bus *bus;
struct hisi_femac_mdio_data *data;
+ struct clk *clk;
int ret;
bus = mdiobus_alloc_size(sizeof(*data));
@@ -93,26 +93,20 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev)
goto err_out_free_mdiobus;
}
- data->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(data->clk)) {
- ret = PTR_ERR(data->clk);
+ clk = devm_clk_get_prepared(&pdev->dev, NULL);
+ if (IS_ERR(clk)) {
+ ret = PTR_ERR(clk);
goto err_out_free_mdiobus;
}
- ret = clk_prepare_enable(data->clk);
- if (ret)
- goto err_out_free_mdiobus;
-
ret = of_mdiobus_register(bus, np);
if (ret)
- goto err_out_disable_clk;
+ goto err_out_free_mdiobus;
platform_set_drvdata(pdev, bus);
return 0;
-err_out_disable_clk:
- clk_disable_unprepare(data->clk);
err_out_free_mdiobus:
mdiobus_free(bus);
return ret;
@@ -121,10 +115,8 @@ static int hisi_femac_mdio_probe(struct platform_device *pdev)
static void hisi_femac_mdio_remove(struct platform_device *pdev)
{
struct mii_bus *bus = platform_get_drvdata(pdev);
- struct hisi_femac_mdio_data *data = bus->priv;
mdiobus_unregister(bus);
- clk_disable_unprepare(data->clk);
mdiobus_free(bus);
}
--
2.39.0
Powered by blists - more mailing lists