aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorXunlei Pang <pang.xunlei@linaro.org>2015-01-21 21:31:53 -0500
committerJohn Stultz <john.stultz@linaro.org>2015-01-23 20:21:56 -0500
commita6d6e1c879efa4b77e250c34fe5fe1c34e6ef070 (patch)
tree2d5eb6daecb5d37dca5ff23b3a6c0f5988bd8d11 /drivers/rtc
parent4ec2364f4910234030906b3f824b51c0d7065334 (diff)
rtc: Modify rtc_hctosys() to address y2038 issues
rtc_hctosys() has a number of y2038 issues. This patch resolves them by: - Replace rtc_tm_to_time() with y2038-safe rtc_tm_to_time64() - Replace do_settimeofday() with y2038-safe do_settimeofday64() After this patch, it should not have any remaining y2038 issues. Cc: pang.xunlei <pang.xunlei@linaro.org> Cc: Arnd Bergmann <arnd.bergmann@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/hctosys.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/rtc/hctosys.c b/drivers/rtc/hctosys.c
index 4aa60d74004e..2153b526d61f 100644
--- a/drivers/rtc/hctosys.c
+++ b/drivers/rtc/hctosys.c
@@ -26,7 +26,7 @@ static int __init rtc_hctosys(void)
26{ 26{
27 int err = -ENODEV; 27 int err = -ENODEV;
28 struct rtc_time tm; 28 struct rtc_time tm;
29 struct timespec tv = { 29 struct timespec64 tv64 = {
30 .tv_nsec = NSEC_PER_SEC >> 1, 30 .tv_nsec = NSEC_PER_SEC >> 1,
31 }; 31 };
32 struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); 32 struct rtc_device *rtc = rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE);
@@ -52,16 +52,16 @@ static int __init rtc_hctosys(void)
52 goto err_invalid; 52 goto err_invalid;
53 } 53 }
54 54
55 rtc_tm_to_time(&tm, &tv.tv_sec); 55 tv64.tv_sec = rtc_tm_to_time64(&tm);
56 56
57 err = do_settimeofday(&tv); 57 err = do_settimeofday64(&tv64);
58 58
59 dev_info(rtc->dev.parent, 59 dev_info(rtc->dev.parent,
60 "setting system clock to " 60 "setting system clock to "
61 "%d-%02d-%02d %02d:%02d:%02d UTC (%u)\n", 61 "%d-%02d-%02d %02d:%02d:%02d UTC (%lld)\n",
62 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 62 tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
63 tm.tm_hour, tm.tm_min, tm.tm_sec, 63 tm.tm_hour, tm.tm_min, tm.tm_sec,
64 (unsigned int) tv.tv_sec); 64 (long long) tv64.tv_sec);
65 65
66err_invalid: 66err_invalid:
67err_read: 67err_read: