hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/rtc/rtc-digicolor.c
....@@ -1,14 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0+
12 /*
23 * Real Time Clock driver for Conexant Digicolor
34 *
45 * Copyright (C) 2015 Paradox Innovation Ltd.
56 *
67 * Author: Baruch Siach <baruch@tkos.co.il>
7
- *
8
- * This program is free software; you can redistribute it and/or modify it
9
- * under the terms of the GNU General Public License as published by the
10
- * Free Software Foundation; either version 2 of the License, or (at your
11
- * option) any later version.
128 */
139
1410 #include <linux/io.h>
....@@ -106,11 +102,11 @@
106102 return 0;
107103 }
108104
109
-static int dc_rtc_set_mmss(struct device *dev, unsigned long secs)
105
+static int dc_rtc_set_time(struct device *dev, struct rtc_time *tm)
110106 {
111107 struct dc_rtc *rtc = dev_get_drvdata(dev);
112108
113
- return dc_rtc_write(rtc, secs);
109
+ return dc_rtc_write(rtc, rtc_tm_to_time64(tm));
114110 }
115111
116112 static int dc_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
....@@ -161,7 +157,7 @@
161157
162158 static const struct rtc_class_ops dc_rtc_ops = {
163159 .read_time = dc_rtc_read_time,
164
- .set_mmss = dc_rtc_set_mmss,
160
+ .set_time = dc_rtc_set_time,
165161 .read_alarm = dc_rtc_read_alarm,
166162 .set_alarm = dc_rtc_set_alarm,
167163 .alarm_irq_enable = dc_rtc_alarm_irq_enable,
....@@ -179,7 +175,6 @@
179175
180176 static int __init dc_rtc_probe(struct platform_device *pdev)
181177 {
182
- struct resource *res;
183178 struct dc_rtc *rtc;
184179 int irq, ret;
185180
....@@ -187,10 +182,13 @@
187182 if (!rtc)
188183 return -ENOMEM;
189184
190
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
191
- rtc->regs = devm_ioremap_resource(&pdev->dev, res);
185
+ rtc->regs = devm_platform_ioremap_resource(pdev, 0);
192186 if (IS_ERR(rtc->regs))
193187 return PTR_ERR(rtc->regs);
188
+
189
+ rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
190
+ if (IS_ERR(rtc->rtc_dev))
191
+ return PTR_ERR(rtc->rtc_dev);
194192
195193 irq = platform_get_irq(pdev, 0);
196194 if (irq < 0)
....@@ -200,12 +198,11 @@
200198 return ret;
201199
202200 platform_set_drvdata(pdev, rtc);
203
- rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name,
204
- &dc_rtc_ops, THIS_MODULE);
205
- if (IS_ERR(rtc->rtc_dev))
206
- return PTR_ERR(rtc->rtc_dev);
207201
208
- return 0;
202
+ rtc->rtc_dev->ops = &dc_rtc_ops;
203
+ rtc->rtc_dev->range_max = U32_MAX;
204
+
205
+ return rtc_register_device(rtc->rtc_dev);
209206 }
210207
211208 static const struct of_device_id dc_dt_ids[] = {