diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-09 17:46:33 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-09 17:46:33 -0400 |
commit | 8e4ff713ce313dcabbb60e6ede1ffc193e67631f (patch) | |
tree | 8efdfe4925570ec8608d40e229ed01a5432d901e /drivers/rtc/class.c | |
parent | 45182e4e1f8ac04708ca7508c51d9103f07d81ab (diff) | |
parent | dacb6a4035a010e41abaf81c1cfe2beadfb05ec8 (diff) |
Merge tag 'rtc-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni:
"A huge series from me this cycle. I went through many drivers to set
the date and time range supported by the RTC which helps solving HW
limitation when the time comes (as early as next year for some). This
time, I focused on drivers using .set_mms and .set_mmss64, allowing me
to remove those callbacks. About a third of the patches got reviews, I
actually own the RTCs and I tested another third and the remaining one
are unlikely to cause any issues.
Other than that, a single new driver and the usual fixes here and there.
Summary:
Subsystem:
- set_mmss and set_mmss64 rtc_ops removal
- Fix timestamp value for RTC_TIMESTAMP_BEGIN_1900
- Use SPDX identifier for the core
- validate upper bound of tm->tm_year
New driver:
- Aspeed BMC SoC RTC
Drivers:
- abx80x: use rtc_add_group
- ds3232: nvram support
- pcf85063: add alarm, nvram, offset correction and microcrystal
rv8263 support
- x1205: add of_match_table
- Use set_time instead of set_mms/set_mmss64 for: ab3100, coh901331,
digicolor, ds1672, ds2404, ep93xx, imxdi, jz4740, lpc32xx, mc13xxx,
mxc, pcap, stmp3xxx, test, wm831x, xgene.
- Set RTC range for: ab3100, at91sam9, coh901331, da9063, digicolor,
dm355evm, ds1672, ds2404, ep39xx, goldfish, imxdi, jz4740, lpc32xx,
mc13xxx, mv, mxc, omap, pcap, pcf85063, pcf85363, ps3, sh,
stmp3xxx, sun4v, tegra, wm831x, xgene.
- Switch to rtc_time64_to_tm/rtc_tm_to_time64 for the driver that
properly set the RTC range.
- Use dev_get_drvdata instead of multiple indirections"
* tag 'rtc-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (177 commits)
rtc: snvs: Use __maybe_unused instead of #if CONFIG_PM_SLEEP
rtc: imxdi: remove unused variable
rtc: drop set_mms and set_mmss64
rtc: pcap: convert to SPDX identifier
rtc: pcap: use .set_time
rtc: pcap: switch to rtc_time64_to_tm/rtc_tm_to_time64
rtc: pcap: set range
rtc: digicolor: convert to SPDX identifier
rtc: digicolor: use .set_time
rtc: digicolor: set range
rtc: digicolor: fix possible race condition
rtc: jz4740: convert to SPDX identifier
rtc: jz4740: rework invalid time detection
rtc: jz4740: use dev_pm_set_wake_irq() to simplify code
rtc: jz4740: use .set_time
rtc: jz4740: remove useless check
rtc: jz4740: switch to rtc_time64_to_tm/rtc_tm_to_time64
rtc: jz4740: set range
rtc: 88pm860x: prevent use-after-free on device remove
rtc: Use dev_get_drvdata()
...
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r-- | drivers/rtc/class.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index ac93b76f2b11..0f492b0940b3 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -1,3 +1,4 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
1 | /* | 2 | /* |
2 | * RTC subsystem, base class | 3 | * RTC subsystem, base class |
3 | * | 4 | * |
@@ -5,11 +6,7 @@ | |||
5 | * Author: Alessandro Zummo <a.zummo@towertech.it> | 6 | * Author: Alessandro Zummo <a.zummo@towertech.it> |
6 | * | 7 | * |
7 | * class skeleton from drivers/hwmon/hwmon.c | 8 | * class skeleton from drivers/hwmon/hwmon.c |
8 | * | 9 | */ |
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | 10 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 11 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
15 | 12 | ||
@@ -23,13 +20,13 @@ | |||
23 | 20 | ||
24 | #include "rtc-core.h" | 21 | #include "rtc-core.h" |
25 | 22 | ||
26 | |||
27 | static DEFINE_IDA(rtc_ida); | 23 | static DEFINE_IDA(rtc_ida); |
28 | struct class *rtc_class; | 24 | struct class *rtc_class; |
29 | 25 | ||
30 | static void rtc_device_release(struct device *dev) | 26 | static void rtc_device_release(struct device *dev) |
31 | { | 27 | { |
32 | struct rtc_device *rtc = to_rtc_device(dev); | 28 | struct rtc_device *rtc = to_rtc_device(dev); |
29 | |||
33 | ida_simple_remove(&rtc_ida, rtc->id); | 30 | ida_simple_remove(&rtc_ida, rtc->id); |
34 | kfree(rtc); | 31 | kfree(rtc); |
35 | } | 32 | } |
@@ -47,7 +44,6 @@ int rtc_hctosys_ret = -ENODEV; | |||
47 | 44 | ||
48 | static struct timespec64 old_rtc, old_system, old_delta; | 45 | static struct timespec64 old_rtc, old_system, old_delta; |
49 | 46 | ||
50 | |||
51 | static int rtc_suspend(struct device *dev) | 47 | static int rtc_suspend(struct device *dev) |
52 | { | 48 | { |
53 | struct rtc_device *rtc = to_rtc_device(dev); | 49 | struct rtc_device *rtc = to_rtc_device(dev); |
@@ -71,7 +67,6 @@ static int rtc_suspend(struct device *dev) | |||
71 | ktime_get_real_ts64(&old_system); | 67 | ktime_get_real_ts64(&old_system); |
72 | old_rtc.tv_sec = rtc_tm_to_time64(&tm); | 68 | old_rtc.tv_sec = rtc_tm_to_time64(&tm); |
73 | 69 | ||
74 | |||
75 | /* | 70 | /* |
76 | * To avoid drift caused by repeated suspend/resumes, | 71 | * To avoid drift caused by repeated suspend/resumes, |
77 | * which each can add ~1 second drift error, | 72 | * which each can add ~1 second drift error, |
@@ -83,7 +78,7 @@ static int rtc_suspend(struct device *dev) | |||
83 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { | 78 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { |
84 | /* | 79 | /* |
85 | * if delta_delta is too large, assume time correction | 80 | * if delta_delta is too large, assume time correction |
86 | * has occured and set old_delta to the current delta. | 81 | * has occurred and set old_delta to the current delta. |
87 | */ | 82 | */ |
88 | old_delta = delta; | 83 | old_delta = delta; |
89 | } else { | 84 | } else { |
@@ -136,7 +131,7 @@ static int rtc_resume(struct device *dev) | |||
136 | * to keep things accurate. | 131 | * to keep things accurate. |
137 | */ | 132 | */ |
138 | sleep_time = timespec64_sub(sleep_time, | 133 | sleep_time = timespec64_sub(sleep_time, |
139 | timespec64_sub(new_system, old_system)); | 134 | timespec64_sub(new_system, old_system)); |
140 | 135 | ||
141 | if (sleep_time.tv_sec >= 0) | 136 | if (sleep_time.tv_sec >= 0) |
142 | timekeeping_inject_sleeptime64(&sleep_time); | 137 | timekeeping_inject_sleeptime64(&sleep_time); |
@@ -397,9 +392,9 @@ EXPORT_SYMBOL_GPL(__rtc_register_device); | |||
397 | * rtc_register_device instead | 392 | * rtc_register_device instead |
398 | */ | 393 | */ |
399 | struct rtc_device *devm_rtc_device_register(struct device *dev, | 394 | struct rtc_device *devm_rtc_device_register(struct device *dev, |
400 | const char *name, | 395 | const char *name, |
401 | const struct rtc_class_ops *ops, | 396 | const struct rtc_class_ops *ops, |
402 | struct module *owner) | 397 | struct module *owner) |
403 | { | 398 | { |
404 | struct rtc_device *rtc; | 399 | struct rtc_device *rtc; |
405 | int err; | 400 | int err; |