[RFC PATCH v2 3/9] rtc/test: Update driver to address y2038/y2106 issues

From: Xunlei Pang
Date: Tue Jan 13 2015 - 10:46:46 EST


From: Xunlei Pang <pang.xunlei@xxxxxxxxxx>

This driver has a number of y2038/y2106 issues.

This patch resolves them by:
- Repalce get_seconds() with get_seconds64()
- Replace rtc_time_to_tm() with rtc_time64_to_tm()
- Change test_rtc_set_mmss() to use rtc_class_ops's set_mmss64()

After this patch, this driver should not have any remaining
y2038/y2106 issues.

Signed-off-by: Xunlei Pang <pang.xunlei@xxxxxxxxxx>
---
drivers/rtc/rtc-test.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 8f86fa9..056138b 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -30,13 +30,13 @@ static int test_rtc_set_alarm(struct device *dev,
static int test_rtc_read_time(struct device *dev,
struct rtc_time *tm)
{
- rtc_time_to_tm(get_seconds(), tm);
+ rtc_time64_to_tm(get_seconds64(), tm);
return 0;
}

-static int test_rtc_set_mmss(struct device *dev, unsigned long secs)
+static int test_rtc_set_mmss(struct device *dev, time64_t secs)
{
- dev_info(dev, "%s, secs = %lu\n", __func__, secs);
+ dev_info(dev, "%s, secs = %lld\n", __func__, (long long)secs);
return 0;
}

@@ -60,7 +60,7 @@ static const struct rtc_class_ops test_rtc_ops = {
.read_time = test_rtc_read_time,
.read_alarm = test_rtc_read_alarm,
.set_alarm = test_rtc_set_alarm,
- .set_mmss = test_rtc_set_mmss,
+ .set_mmss64 = test_rtc_set_mmss,
.alarm_irq_enable = test_rtc_alarm_irq_enable,
};

--
1.9.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/