diff options
author | Xunlei Pang <pang.xunlei@linaro.org> | 2015-04-01 23:34:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-03 02:18:24 -0400 |
commit | 4d644ab84c6ed66f7a628c74d83c34d85bec13bf (patch) | |
tree | 4ae8c019cade838bf75e1b8e8e4583554ac8360a /drivers/rtc | |
parent | 8e4ff1a81aa91d12856287c7103d0301ac91351a (diff) |
drivers/rtc/test: Update driver to address y2038/y2106 issues
This driver has a number of y2038/y2106 issues.
This patch resolves them by:
- Replacing get_seconds() with ktime_get_real_seconds()
- Replacing rtc_time_to_tm() with rtc_time64_to_tm()
Also add test_rtc_set_mmss64() for testing rtc_class_ops's
set_mmss64(), which can be activated by "test_mmss64" module
parameter.
Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1427945681-29972-9-git-send-email-john.stultz@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-test.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 8f86fa91de1a..3a2da4c892d6 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -13,6 +13,10 @@ | |||
13 | #include <linux/rtc.h> | 13 | #include <linux/rtc.h> |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | 15 | ||
16 | static int test_mmss64; | ||
17 | module_param(test_mmss64, int, 0644); | ||
18 | MODULE_PARM_DESC(test_mmss64, "Test struct rtc_class_ops.set_mmss64()."); | ||
19 | |||
16 | static struct platform_device *test0 = NULL, *test1 = NULL; | 20 | static struct platform_device *test0 = NULL, *test1 = NULL; |
17 | 21 | ||
18 | static int test_rtc_read_alarm(struct device *dev, | 22 | static int test_rtc_read_alarm(struct device *dev, |
@@ -30,7 +34,13 @@ static int test_rtc_set_alarm(struct device *dev, | |||
30 | static int test_rtc_read_time(struct device *dev, | 34 | static int test_rtc_read_time(struct device *dev, |
31 | struct rtc_time *tm) | 35 | struct rtc_time *tm) |
32 | { | 36 | { |
33 | rtc_time_to_tm(get_seconds(), tm); | 37 | rtc_time64_to_tm(ktime_get_real_seconds(), tm); |
38 | return 0; | ||
39 | } | ||
40 | |||
41 | static int test_rtc_set_mmss64(struct device *dev, time64_t secs) | ||
42 | { | ||
43 | dev_info(dev, "%s, secs = %lld\n", __func__, (long long)secs); | ||
34 | return 0; | 44 | return 0; |
35 | } | 45 | } |
36 | 46 | ||
@@ -55,7 +65,7 @@ static int test_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) | |||
55 | return 0; | 65 | return 0; |
56 | } | 66 | } |
57 | 67 | ||
58 | static const struct rtc_class_ops test_rtc_ops = { | 68 | static struct rtc_class_ops test_rtc_ops = { |
59 | .proc = test_rtc_proc, | 69 | .proc = test_rtc_proc, |
60 | .read_time = test_rtc_read_time, | 70 | .read_time = test_rtc_read_time, |
61 | .read_alarm = test_rtc_read_alarm, | 71 | .read_alarm = test_rtc_read_alarm, |
@@ -101,6 +111,11 @@ static int test_probe(struct platform_device *plat_dev) | |||
101 | int err; | 111 | int err; |
102 | struct rtc_device *rtc; | 112 | struct rtc_device *rtc; |
103 | 113 | ||
114 | if (test_mmss64) { | ||
115 | test_rtc_ops.set_mmss64 = test_rtc_set_mmss64; | ||
116 | test_rtc_ops.set_mmss = NULL; | ||
117 | } | ||
118 | |||
104 | rtc = devm_rtc_device_register(&plat_dev->dev, "test", | 119 | rtc = devm_rtc_device_register(&plat_dev->dev, "test", |
105 | &test_rtc_ops, THIS_MODULE); | 120 | &test_rtc_ops, THIS_MODULE); |
106 | if (IS_ERR(rtc)) { | 121 | if (IS_ERR(rtc)) { |