@@ -174,18 +174,16 @@ static const struct rtc_class_ops sa1100_rtc_ops = {
int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info)
{
int ret;
+ struct clk *clk;
spin_lock_init(&info->lock);
- info->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(info->clk)) {
+ clk = devm_clk_get_enabled(&pdev->dev, NULL);
+ if (IS_ERR(clk)) {
dev_err(&pdev->dev, "failed to find rtc clock source\n");
- return PTR_ERR(info->clk);
+ return PTR_ERR(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 +204,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 +301,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);
}
}
@@ -4,7 +4,6 @@
#include <linux/kernel.h>
-struct clk;
struct platform_device;
struct sa1100_rtc {
@@ -16,7 +15,6 @@ struct sa1100_rtc {
int irq_1hz;
int irq_alarm;
struct rtc_device *rtc;
- struct clk *clk;
};
int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info);
Use devm_clk_get_enabled() instead of clk functions in rtc-sa1100. Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com> --- v2:remove the clk field in struct sa1100_rtc. --- drivers/rtc/rtc-sa1100.c | 15 +++++---------- drivers/rtc/rtc-sa1100.h | 2 -- 2 files changed, 5 insertions(+), 12 deletions(-)