diff options
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r-- | drivers/rtc/class.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index 22190ad28e8b..0f492b0940b3 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -20,13 +20,13 @@ | |||
20 | 20 | ||
21 | #include "rtc-core.h" | 21 | #include "rtc-core.h" |
22 | 22 | ||
23 | |||
24 | static DEFINE_IDA(rtc_ida); | 23 | static DEFINE_IDA(rtc_ida); |
25 | struct class *rtc_class; | 24 | struct class *rtc_class; |
26 | 25 | ||
27 | static void rtc_device_release(struct device *dev) | 26 | static void rtc_device_release(struct device *dev) |
28 | { | 27 | { |
29 | struct rtc_device *rtc = to_rtc_device(dev); | 28 | struct rtc_device *rtc = to_rtc_device(dev); |
29 | |||
30 | ida_simple_remove(&rtc_ida, rtc->id); | 30 | ida_simple_remove(&rtc_ida, rtc->id); |
31 | kfree(rtc); | 31 | kfree(rtc); |
32 | } | 32 | } |
@@ -44,7 +44,6 @@ int rtc_hctosys_ret = -ENODEV; | |||
44 | 44 | ||
45 | static struct timespec64 old_rtc, old_system, old_delta; | 45 | static struct timespec64 old_rtc, old_system, old_delta; |
46 | 46 | ||
47 | |||
48 | static int rtc_suspend(struct device *dev) | 47 | static int rtc_suspend(struct device *dev) |
49 | { | 48 | { |
50 | struct rtc_device *rtc = to_rtc_device(dev); | 49 | struct rtc_device *rtc = to_rtc_device(dev); |
@@ -68,7 +67,6 @@ static int rtc_suspend(struct device *dev) | |||
68 | ktime_get_real_ts64(&old_system); | 67 | ktime_get_real_ts64(&old_system); |
69 | old_rtc.tv_sec = rtc_tm_to_time64(&tm); | 68 | old_rtc.tv_sec = rtc_tm_to_time64(&tm); |
70 | 69 | ||
71 | |||
72 | /* | 70 | /* |
73 | * To avoid drift caused by repeated suspend/resumes, | 71 | * To avoid drift caused by repeated suspend/resumes, |
74 | * which each can add ~1 second drift error, | 72 | * which each can add ~1 second drift error, |
@@ -80,7 +78,7 @@ static int rtc_suspend(struct device *dev) | |||
80 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { | 78 | if (delta_delta.tv_sec < -2 || delta_delta.tv_sec >= 2) { |
81 | /* | 79 | /* |
82 | * if delta_delta is too large, assume time correction | 80 | * if delta_delta is too large, assume time correction |
83 | * has occured and set old_delta to the current delta. | 81 | * has occurred and set old_delta to the current delta. |
84 | */ | 82 | */ |
85 | old_delta = delta; | 83 | old_delta = delta; |
86 | } else { | 84 | } else { |
@@ -133,7 +131,7 @@ static int rtc_resume(struct device *dev) | |||
133 | * to keep things accurate. | 131 | * to keep things accurate. |
134 | */ | 132 | */ |
135 | sleep_time = timespec64_sub(sleep_time, | 133 | sleep_time = timespec64_sub(sleep_time, |
136 | timespec64_sub(new_system, old_system)); | 134 | timespec64_sub(new_system, old_system)); |
137 | 135 | ||
138 | if (sleep_time.tv_sec >= 0) | 136 | if (sleep_time.tv_sec >= 0) |
139 | timekeeping_inject_sleeptime64(&sleep_time); | 137 | timekeeping_inject_sleeptime64(&sleep_time); |
@@ -394,9 +392,9 @@ EXPORT_SYMBOL_GPL(__rtc_register_device); | |||
394 | * rtc_register_device instead | 392 | * rtc_register_device instead |
395 | */ | 393 | */ |
396 | struct rtc_device *devm_rtc_device_register(struct device *dev, | 394 | struct rtc_device *devm_rtc_device_register(struct device *dev, |
397 | const char *name, | 395 | const char *name, |
398 | const struct rtc_class_ops *ops, | 396 | const struct rtc_class_ops *ops, |
399 | struct module *owner) | 397 | struct module *owner) |
400 | { | 398 | { |
401 | struct rtc_device *rtc; | 399 | struct rtc_device *rtc; |
402 | int err; | 400 | int err; |