* [PATCH -next] mfd: mxs-lradc: Use the devm_clk_get_enabled() helper function
@ 2023-08-18 9:33 Ruan Jinjie
2023-08-21 11:20 ` Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: Ruan Jinjie @ 2023-08-18 9:33 UTC (permalink / raw)
To: linux-arm-kernel, linux-imx, Lee Jones, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
Cc: ruanjinjie
With devm_clk_get_enabled() the call to clk_disable_unprepare() can be
dropped from the error path and the remove callback.
Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
drivers/mfd/mxs-lradc.c | 35 ++++++++---------------------------
1 file changed, 8 insertions(+), 27 deletions(-)
diff --git a/drivers/mfd/mxs-lradc.c b/drivers/mfd/mxs-lradc.c
index 111d11fd25aa..6d6d417bad5a 100644
--- a/drivers/mfd/mxs-lradc.c
+++ b/drivers/mfd/mxs-lradc.c
@@ -144,16 +144,10 @@ static int mxs_lradc_probe(struct platform_device *pdev)
lradc->soc = (enum mxs_lradc_id)of_id->data;
- lradc->clk = devm_clk_get(&pdev->dev, NULL);
+ lradc->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(lradc->clk)) {
- dev_err(dev, "Failed to get the delay unit clock\n");
- return PTR_ERR(lradc->clk);
- }
-
- ret = clk_prepare_enable(lradc->clk);
- if (ret) {
dev_err(dev, "Failed to enable the delay unit clock\n");
- return ret;
+ return PTR_ERR(lradc->clk);
}
ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
@@ -177,8 +171,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"Unsupported number of touchscreen wires (%d)\n"
, ts_wires);
- ret = -EINVAL;
- goto err_clk;
+ return -EINVAL;
}
} else {
lradc->buffer_vchans = BUFFER_VCHANS_ALL;
@@ -187,10 +180,8 @@ static int mxs_lradc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, lradc);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
- ret = -ENOMEM;
- goto err_clk;
- }
+ if (!res)
+ return -ENOMEM;
switch (lradc->soc) {
case IMX23_LRADC:
@@ -205,15 +196,14 @@ static int mxs_lradc_probe(struct platform_device *pdev)
break;
default:
dev_err(dev, "Unsupported SoC\n");
- ret = -ENODEV;
- goto err_clk;
+ return -ENODEV;
}
ret = devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_NONE,
&cells[ADC_CELL], 1, NULL, 0, NULL);
if (ret) {
dev_err(&pdev->dev, "Failed to add the ADC subdevice\n");
- goto err_clk;
+ return ret;
}
if (!lradc->touchscreen_wire)
@@ -224,23 +214,14 @@ static int mxs_lradc_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"Failed to add the touchscreen subdevice\n");
- goto err_clk;
+ return ret;
}
return 0;
-
-err_clk:
- clk_disable_unprepare(lradc->clk);
-
- return ret;
}
static int mxs_lradc_remove(struct platform_device *pdev)
{
- struct mxs_lradc *lradc = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(lradc->clk);
-
return 0;
}
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] mfd: mxs-lradc: Use the devm_clk_get_enabled() helper function
2023-08-18 9:33 [PATCH -next] mfd: mxs-lradc: Use the devm_clk_get_enabled() helper function Ruan Jinjie
@ 2023-08-21 11:20 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2023-08-21 11:20 UTC (permalink / raw)
To: Ruan Jinjie
Cc: linux-arm-kernel, linux-imx, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam
On Fri, 18 Aug 2023, Ruan Jinjie wrote:
> With devm_clk_get_enabled() the call to clk_disable_unprepare() can be
> dropped from the error path and the remove callback.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
> drivers/mfd/mxs-lradc.c | 35 ++++++++---------------------------
> 1 file changed, 8 insertions(+), 27 deletions(-)
Doesn't apply. Please rebase and resubmit.
--
Lee Jones [李琼斯]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-21 11:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18 9:33 [PATCH -next] mfd: mxs-lradc: Use the devm_clk_get_enabled() helper function Ruan Jinjie
2023-08-21 11:20 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).