Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752593AbdFTJhS (ORCPT ); Tue, 20 Jun 2017 05:37:18 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:34897 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbdFTJhO (ORCPT ); Tue, 20 Jun 2017 05:37:14 -0400 From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Cc: linaro-kernel@lists.linaro.org, Jason Cooper , Gregory Clement , Sebastian Hesselbarth , Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: [PATCH 08/51] rtc: armada38x: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:16 +0200 Message-Id: <1497951359-13334-9-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: 3359 Lines: 108 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: Jason Cooper CC: Gregory Clement CC: Sebastian Hesselbarth CC: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org --- drivers/rtc/rtc-armada38x.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/rtc/rtc-armada38x.c b/drivers/rtc/rtc-armada38x.c index 21f355c..752ebf4 100644 --- a/drivers/rtc/rtc-armada38x.c +++ b/drivers/rtc/rtc-armada38x.c @@ -213,13 +213,14 @@ static void armada8k_unmask_interrupt(struct armada38x_rtc *rtc) static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - unsigned long time, flags; + unsigned long long time; + unsigned long flags; spin_lock_irqsave(&rtc->lock, flags); time = rtc->data->read_rtc_reg(rtc, RTC_TIME); spin_unlock_irqrestore(&rtc->lock, flags); - rtc_time_to_tm(time, tm); + rtc_time64_to_tm(time, tm); return 0; } @@ -227,26 +228,23 @@ static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm) static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - int ret = 0; - unsigned long time, flags; - - ret = rtc_tm_to_time(tm, &time); + unsigned long long time; + unsigned long flags; - if (ret) - goto out; + time = rtc_tm_to_time64(tm); spin_lock_irqsave(&rtc->lock, flags); rtc_delayed_write(time, rtc, RTC_TIME); spin_unlock_irqrestore(&rtc->lock, flags); -out: - return ret; + return 0; } static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct armada38x_rtc *rtc = dev_get_drvdata(dev); - unsigned long time, flags; + unsigned long long time; + unsigned long flags; u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm); u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm); u32 val; @@ -259,7 +257,7 @@ static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) spin_unlock_irqrestore(&rtc->lock, flags); alrm->enabled = val ? 1 : 0; - rtc_time_to_tm(time, &alrm->time); + rtc_time64_to_tm(time, &alrm->time); return 0; } @@ -269,13 +267,10 @@ static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) struct armada38x_rtc *rtc = dev_get_drvdata(dev); u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm); u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm); - unsigned long time, flags; - int ret = 0; - - ret = rtc_tm_to_time(&alrm->time, &time); + unsigned long long time; + unsigned long flags; - if (ret) - goto out; + time = rtc_tm_to_time64(&alrm->time); spin_lock_irqsave(&rtc->lock, flags); @@ -288,8 +283,7 @@ static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) spin_unlock_irqrestore(&rtc->lock, flags); -out: - return ret; + return 0; } static int armada38x_rtc_alarm_irq_enable(struct device *dev, -- 1.9.1