diff mbox series

[04/13] iio: adc: ad9467: Benefit from devm_clk_get_prepared() to simplify

Message ID 20220808204740.307667-4-u.kleine-koenig@pengutronix.de (mailing list archive)
State Accepted
Headers show
Series [01/13] iio: adc: ad7124: Benefit from devm_clk_get_enabled() to simplify | expand

Commit Message

Uwe Kleine-König Aug. 8, 2022, 8:47 p.m. UTC
Make use of devm_clk_get_prepared() to replace some code that effectively
open codes this new function.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/iio/adc/ingenic-adc.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

Comments

Andy Shevchenko Aug. 8, 2022, 9:01 p.m. UTC | #1
On Mon, Aug 8, 2022 at 10:47 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Make use of devm_clk_get_prepared() to replace some code that effectively
> open codes this new function.

Copy'n'paste typo in the Subject.
Uwe Kleine-König Aug. 9, 2022, 5:37 a.m. UTC | #2
Hello Andy,

On Mon, Aug 08, 2022 at 11:01:39PM +0200, Andy Shevchenko wrote:
> On Mon, Aug 8, 2022 at 10:47 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > Make use of devm_clk_get_prepared() to replace some code that effectively
> > open codes this new function.
> 
> Copy'n'paste typo in the Subject.

Good catch, thanks. I fixed it in my private tree, so it will be fixed
on resend. The Subject is now:

	iio: adc: ingenic-adc: Benefit from devm_clk_get_prepared() to simplify

Will wait a while for that though, maybe Jonathan will take
care when applying without me resending. I also adapted the subject of
this reply, I wonder if that does more good or more harm :-)

Best regards
Uwe
Jonathan Cameron Aug. 13, 2022, 4:19 p.m. UTC | #3
On Tue, 9 Aug 2022 07:37:40 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

> Hello Andy,
> 
> On Mon, Aug 08, 2022 at 11:01:39PM +0200, Andy Shevchenko wrote:
> > On Mon, Aug 8, 2022 at 10:47 PM Uwe Kleine-K_nig
> > <u.kleine-koenig@pengutronix.de> wrote:  
> > >
> > > Make use of devm_clk_get_prepared() to replace some code that effectively
> > > open codes this new function.  
> > 
> > Copy'n'paste typo in the Subject.  
> 
> Good catch, thanks. I fixed it in my private tree, so it will be fixed
> on resend. The Subject is now:
> 
> 	iio: adc: ingenic-adc: Benefit from devm_clk_get_prepared() to simplify
> 
> Will wait a while for that though, maybe Jonathan will take
> care when applying without me resending. I also adapted the subject of
> this reply, I wonder if that does more good or more harm :-)

I tweaked it whilst applying to be as above.

Thanks,

Jonathan

> 
> Best regards
> Uwe
>
diff mbox series

Patch

diff --git a/drivers/iio/adc/ingenic-adc.c b/drivers/iio/adc/ingenic-adc.c
index 2b3912c6ca6b..b6433bcd53f5 100644
--- a/drivers/iio/adc/ingenic-adc.c
+++ b/drivers/iio/adc/ingenic-adc.c
@@ -732,11 +732,6 @@  static int ingenic_adc_of_xlate(struct iio_dev *iio_dev,
 	return -EINVAL;
 }
 
-static void ingenic_adc_clk_cleanup(void *data)
-{
-	clk_unprepare(data);
-}
-
 static const struct iio_info ingenic_adc_info = {
 	.write_raw = ingenic_adc_write_raw,
 	.read_raw = ingenic_adc_read_raw,
@@ -856,13 +851,13 @@  static int ingenic_adc_probe(struct platform_device *pdev)
 	if (IS_ERR(adc->base))
 		return PTR_ERR(adc->base);
 
-	adc->clk = devm_clk_get(dev, "adc");
+	adc->clk = devm_clk_get_prepared(dev, "adc");
 	if (IS_ERR(adc->clk)) {
 		dev_err(dev, "Unable to get clock\n");
 		return PTR_ERR(adc->clk);
 	}
 
-	ret = clk_prepare_enable(adc->clk);
+	ret = clk_enable(adc->clk);
 	if (ret) {
 		dev_err(dev, "Failed to enable clock\n");
 		return ret;
@@ -891,12 +886,6 @@  static int ingenic_adc_probe(struct platform_device *pdev)
 	usleep_range(2000, 3000); /* Must wait at least 2ms. */
 	clk_disable(adc->clk);
 
-	ret = devm_add_action_or_reset(dev, ingenic_adc_clk_cleanup, adc->clk);
-	if (ret) {
-		dev_err(dev, "Unable to add action\n");
-		return ret;
-	}
-
 	iio_dev->name = "jz-adc";
 	iio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_SOFTWARE;
 	iio_dev->setup_ops = &ingenic_buffer_setup_ops;