Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752704AbdFTJhV (ORCPT ); Tue, 20 Jun 2017 05:37:21 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:33921 "EHLO mail-wr0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbdFTJhT (ORCPT ); Tue, 20 Jun 2017 05:37:19 -0400 From: Benjamin Gaignard To: benjamin.gaignard@linaro.org Cc: linaro-kernel@lists.linaro.org, Alessandro Zummo , Alexandre Belloni , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, adi-buildroot-devel@lists.sourceforge.net Subject: [PATCH 11/51] rtc: bfin: stop using rtc deprecated functions Date: Tue, 20 Jun 2017 11:35:19 +0200 Message-Id: <1497951359-13334-12-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: 2235 Lines: 72 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: Alessandro Zummo CC: Alexandre Belloni CC: rtc-linux@googlegroups.com CC: linux-kernel@vger.kernel.org CC: adi-buildroot-devel@lists.sourceforge.net --- drivers/rtc/rtc-bfin.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 15344b7..4c79bd0 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c @@ -103,7 +103,7 @@ static inline unsigned long rtc_bfin_to_time(u32 rtc_bfin) } static inline void rtc_bfin_to_tm(u32 rtc_bfin, struct rtc_time *tm) { - rtc_time_to_tm(rtc_bfin_to_time(rtc_bfin), tm); + rtc_time64_to_tm(rtc_bfin_to_time(rtc_bfin), tm); } /** @@ -271,20 +271,17 @@ static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm) static int bfin_rtc_set_time(struct device *dev, struct rtc_time *tm) { struct bfin_rtc *rtc = dev_get_drvdata(dev); - int ret; - unsigned long now; + unsigned long long now; dev_dbg_stamp(dev); - ret = rtc_tm_to_time(tm, &now); - if (ret == 0) { - if (rtc->rtc_wrote_regs & 0x1) - bfin_rtc_sync_pending(dev); - bfin_write_RTC_STAT(rtc_time_to_bfin(now)); - rtc->rtc_wrote_regs = 0x1; - } + now = rtc_tm_to_time64(tm); + if (rtc->rtc_wrote_regs & 0x1) + bfin_rtc_sync_pending(dev); + bfin_write_RTC_STAT(rtc_time_to_bfin(now)); + rtc->rtc_wrote_regs = 0x1; - return ret; + return 0; } static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) @@ -300,12 +297,11 @@ static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm) static int bfin_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) { struct bfin_rtc *rtc = dev_get_drvdata(dev); - unsigned long rtc_alarm; + unsigned long long rtc_alarm; dev_dbg_stamp(dev); - if (rtc_tm_to_time(&alrm->time, &rtc_alarm)) - return -EINVAL; + rtc_alarm = rtc_tm_to_time64(&alrm->time); rtc->rtc_alarm = alrm->time; -- 1.9.1