[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <303d0b93-f6b7-44f0-a61a-fc8e558b1173@wanadoo.fr>
Date: Wed, 21 Aug 2024 13:27:11 +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 5/7] rtc:rtc-sa1100: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-sa1100.
>
> Signed-off-by: Liao Yuanhong <liaoyuanhong@...o.com>
> ---
> drivers/rtc/rtc-sa1100.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
> index 0b2cfa8ca05b..2e72daa6a152 100644
> --- a/drivers/rtc/rtc-sa1100.c
> +++ b/drivers/rtc/rtc-sa1100.c
> @@ -177,15 +177,12 @@ int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info)
>
> spin_lock_init(&info->lock);
>
> - info->clk = devm_clk_get(&pdev->dev, NULL);
> + info->clk = devm_clk_get_enabled(&pdev->dev, NULL);
Hi,
the clk field in struct sa1100_rtc could also be easily removed now.
CJ
> if (IS_ERR(info->clk)) {
> dev_err(&pdev->dev, "failed to find rtc clock source\n");
> return PTR_ERR(info->clk);
> }
>
> - ret = clk_prepare_enable(info->clk);
> - if (ret)
> - return ret;
> /*
> * According to the manual we should be able to let RTTR be zero
> * and then a default diviser for a 32.768KHz clock is used.
> @@ -206,10 +203,8 @@ int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info)
> info->rtc->range_max = U32_MAX;
>
> ret = devm_rtc_register_device(info->rtc);
> - if (ret) {
> - clk_disable_unprepare(info->clk);
> + if (ret)
> return ret;
> - }
>
> /* Fix for a nasty initialization problem the in SA11xx RTSR register.
> * See also the comments in sa1100_rtc_interrupt().
> @@ -305,7 +300,6 @@ static void sa1100_rtc_remove(struct platform_device *pdev)
> spin_lock_irq(&info->lock);
> writel_relaxed(0, info->rtsr);
> spin_unlock_irq(&info->lock);
> - clk_disable_unprepare(info->clk);
> }
> }
>
Powered by blists - more mailing lists