Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753111AbdFTJlE (ORCPT ); Tue, 20 Jun 2017 05:41:04 -0400 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34378 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753113AbdFTJij (ORCPT ); Tue, 20 Jun 2017 05:38:39 -0400 From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Cc: linaro-kernel@lists.linaro.org, Thierry Reding , Jonathan Hunter , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org Subject: [PATCH 45/51] rtc: tegra stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:53 +0200 Message-Id: <1497951359-13334-46-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> References: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3613 Lines: 104 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 CC: Thierry Reding CC: Jonathan Hunter CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: linux-tegra@vger.kernel.org --- drivers/rtc/rtc-tegra.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c index d30d57b..a429884 100644 --- a/drivers/rtc/rtc-tegra.c +++ b/drivers/rtc/rtc-tegra.c @@ -110,7 +110,7 @@ static int tegra_rtc_wait_while_busy(struct device *dev) static int tegra_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct tegra_rtc_info *info = dev_get_drvdata(dev); - unsigned long sec, msec; + unsigned long long sec, msec; unsigned long sl_irq_flags; /* RTC hardware copies seconds to shadow seconds when a read @@ -122,9 +122,9 @@ static int tegra_rtc_read_time(struct device *dev, struct rtc_time *tm) spin_unlock_irqrestore(&info->tegra_rtc_lock, sl_irq_flags); - rtc_time_to_tm(sec, tm); + rtc_time64_to_tm(sec, tm); - dev_vdbg(dev, "time read as %lu. %d/%d/%d %d:%02u:%02u\n", + dev_vdbg(dev, "time read as %llu. %d/%d/%d %d:%02u:%02u\n", sec, tm->tm_mon + 1, tm->tm_mday, @@ -140,7 +140,7 @@ static int tegra_rtc_read_time(struct device *dev, struct rtc_time *tm) static int tegra_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct tegra_rtc_info *info = dev_get_drvdata(dev); - unsigned long sec; + unsigned long long sec; int ret; /* convert tm to seconds. */ @@ -148,9 +148,9 @@ static int tegra_rtc_set_time(struct device *dev, struct rtc_time *tm) if (ret) return ret; - rtc_tm_to_time(tm, &sec); + sec = rtc_tm_to_time64(tm); - dev_vdbg(dev, "time set to %lu. %d/%d/%d %d:%02u:%02u\n", + dev_vdbg(dev, "time set to %llu. %d/%d/%d %d:%02u:%02u\n", sec, tm->tm_mon+1, tm->tm_mday, @@ -174,7 +174,7 @@ static int tegra_rtc_set_time(struct device *dev, struct rtc_time *tm) static int tegra_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) { struct tegra_rtc_info *info = dev_get_drvdata(dev); - unsigned long sec; + unsigned long long sec; unsigned tmp; sec = readl(info->rtc_base + TEGRA_RTC_REG_SECONDS_ALARM0); @@ -185,7 +185,7 @@ static int tegra_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alarm) } else { /* alarm is enabled. */ alarm->enabled = 1; - rtc_time_to_tm(sec, &alarm->time); + rtc_time64_to_tm(sec, &alarm->time); } tmp = readl(info->rtc_base + TEGRA_RTC_REG_INTR_STATUS); @@ -220,10 +220,10 @@ static int tegra_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) static int tegra_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) { struct tegra_rtc_info *info = dev_get_drvdata(dev); - unsigned long sec; + unsigned long long sec; if (alarm->enabled) - rtc_tm_to_time(&alarm->time, &sec); + sec = rtc_tm_to_time64(&alarm->time); else sec = 0; @@ -236,7 +236,7 @@ static int tegra_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm) if (sec) { tegra_rtc_alarm_irq_enable(dev, 1); - dev_vdbg(dev, "alarm set as %lu. %d/%d/%d %d:%02u:%02u\n", + dev_vdbg(dev, "alarm set as %llu. %d/%d/%d %d:%02u:%02u\n", sec, alarm->time.tm_mon+1, alarm->time.tm_mday, -- 1.9.1