[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29b1476e-28ca-4332-975d-c8ae630316bf@wanadoo.fr>
Date: Wed, 21 Aug 2024 13:22:56 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Liao Yuanhong <liaoyuanhong@...o.com>, alexandre.belloni@...tlin.com,
linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/7] rtc:rtc-at91rm9200:Use devm_clk_get_enabled() helpers
Le 21/08/2024 à 11:28, Liao Yuanhong a écrit :
> Use devm_clk_get_enabled() instead of clk functions in rtc-at91rm9200.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
> ---
> drivers/rtc/rtc-at91rm9200.c | 18 +++---------------
> 1 file changed, 3 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
> index c16fe711a0d9..81b2556930bb 100644
> --- a/drivers/rtc/rtc-at91rm9200.c
> +++ b/drivers/rtc/rtc-at91rm9200.c
> @@ -498,14 +498,9 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
> return PTR_ERR(rtc);
> platform_set_drvdata(pdev, rtc);
>
> - sclk = devm_clk_get(&pdev->dev, NULL);
> + sclk = devm_clk_get_enabled(&pdev->dev, NULL);
Hi,
so now the global sclk variable could easily be removed as well.
CJ
> if (IS_ERR(sclk))
> return PTR_ERR(sclk);
> -
> - ret = clk_prepare_enable(sclk);
> - if (ret) {
> - dev_err(&pdev->dev, "Could not enable slow clock\n");
> - return ret;
> }
>
> at91_rtc_write(AT91_RTC_CR, 0);
> @@ -521,7 +516,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
> "at91_rtc", pdev);
> if (ret) {
> dev_err(&pdev->dev, "IRQ %d already in use.\n", irq);
> - goto err_clk;
> + return ret;
> }
>
> /* cpu init code should really have flagged this device as
> @@ -539,7 +534,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
> rtc->range_max = RTC_TIMESTAMP_END_2099;
> ret = devm_rtc_register_device(rtc);
> if (ret)
> - goto err_clk;
> + return ret;
>
> /* enable SECEV interrupt in order to initialize at91_rtc_upd_rdy
> * completion.
> @@ -548,11 +543,6 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
>
> dev_info(&pdev->dev, "AT91 Real Time Clock driver.\n");
> return 0;
> -
> -err_clk:
> - clk_disable_unprepare(sclk);
> -
> - return ret;
> }
>
> /*
> @@ -564,8 +554,6 @@ static void __exit at91_rtc_remove(struct platform_device *pdev)
> at91_rtc_write_idr(AT91_RTC_ACKUPD | AT91_RTC_ALARM |
> AT91_RTC_SECEV | AT91_RTC_TIMEV |
> AT91_RTC_CALEV);
> -
> - clk_disable_unprepare(sclk);
> }
>
> static void at91_rtc_shutdown(struct platform_device *pdev)
Powered by blists - more mailing lists