[v2,07/22] rtc: davinci: stop using rtc deprecated functions

Message ID 1499846682-14093-8-git-send-email-benjamin.gaignard@linaro.org
State New
Headers show
Series
  • [v2,01/22] x86: rtc: stop using rtc deprecated functions
Related show

Commit Message

Benjamin Gaignard July 12, 2017, 8:04 a.m.
rtc_time_to_tm() and rtc_tm_to_time() are deprecated because they
rely on 32bits variables and that will make rtc break in y2038/2016.
Stop using those two functions to safer 64bits ones.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

CC: Alessandro Zummo <a.zummo@towertech.it>
CC: Alexandre Belloni <alexandre.belloni@free-electrons.com>
CC: rtc-linux@googlegroups.com
CC: linux-kernel@vger.kernel.org
---
 drivers/rtc/rtc-davinci.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
1.9.1

Patch

diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
index caf3556..03beba3 100644
--- a/drivers/rtc/rtc-davinci.c
+++ b/drivers/rtc/rtc-davinci.c
@@ -429,18 +429,18 @@  static int davinci_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 	if (alm->time.tm_mday <= 0 && alm->time.tm_mon < 0
 	    && alm->time.tm_year < 0) {
 		struct rtc_time tm;
-		unsigned long now, then;
+		unsigned long long now, then;
 
 		davinci_rtc_read_time(dev, &tm);
-		rtc_tm_to_time(&tm, &now);
+		now = rtc_tm_to_time64(&tm);
 
 		alm->time.tm_mday = tm.tm_mday;
 		alm->time.tm_mon = tm.tm_mon;
 		alm->time.tm_year = tm.tm_year;
-		rtc_tm_to_time(&alm->time, &then);
+		then = rtc_tm_to_time64(&alm->time);
 
 		if (then < now) {
-			rtc_time_to_tm(now + 24 * 60 * 60, &tm);
+			rtc_time64_to_tm(now + 24 * 60 * 60, &tm);
 			alm->time.tm_mday = tm.tm_mday;
 			alm->time.tm_mon = tm.tm_mon;
 			alm->time.tm_year = tm.tm_year;