forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/drivers/rtc/rtc-st-lpc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * rtc-st-lpc.c - ST's LPC RTC, powered by the Low Power Timer
34 *
....@@ -7,11 +8,6 @@
78 * Lee Jones <lee.jones@linaro.org> for STMicroelectronics
89 *
910 * Based on the original driver written by Stuart Menefy.
10
- *
11
- * This program is free software; you can redistribute it and/or
12
- * modify it under the terms of the GNU General Public Licence
13
- * as published by the Free Software Foundation; either version
14
- * 2 of the Licence, or (at your option) any later version.
1511 */
1612
1713 #include <linux/clk.h>
....@@ -45,7 +41,6 @@
4541 struct st_rtc {
4642 struct rtc_device *rtc_dev;
4743 struct rtc_wkalrm alarm;
48
- struct resource *res;
4944 struct clk *clk;
5045 unsigned long clkrate;
5146 void __iomem *ioaddr;
....@@ -166,10 +161,6 @@
166161 now_secs = rtc_tm_to_time64(&now);
167162 alarm_secs = rtc_tm_to_time64(&t->time);
168163
169
- /* Invalid alarm time */
170
- if (now_secs > alarm_secs)
171
- return -EINVAL;
172
-
173164 memcpy(&rtc->alarm, t, sizeof(struct rtc_wkalrm));
174165
175166 /* Now many secs to fire */
....@@ -182,7 +173,7 @@
182173 return 0;
183174 }
184175
185
-static struct rtc_class_ops st_rtc_ops = {
176
+static const struct rtc_class_ops st_rtc_ops = {
186177 .read_time = st_rtc_read_time,
187178 .set_time = st_rtc_set_time,
188179 .read_alarm = st_rtc_read_alarm,
....@@ -194,7 +185,6 @@
194185 {
195186 struct device_node *np = pdev->dev.of_node;
196187 struct st_rtc *rtc;
197
- struct resource *res;
198188 uint32_t mode;
199189 int ret = 0;
200190
....@@ -218,8 +208,7 @@
218208
219209 spin_lock_init(&rtc->lock);
220210
221
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
222
- rtc->ioaddr = devm_ioremap_resource(&pdev->dev, res);
211
+ rtc->ioaddr = devm_platform_ioremap_resource(pdev, 0);
223212 if (IS_ERR(rtc->ioaddr))
224213 return PTR_ERR(rtc->ioaddr);
225214