Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbdFTOSI (ORCPT ); Tue, 20 Jun 2017 10:18:08 -0400 Received: from mail-qt0-f176.google.com ([209.85.216.176]:36528 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751038AbdFTOSH (ORCPT ); Tue, 20 Jun 2017 10:18:07 -0400 MIME-Version: 1.0 In-Reply-To: <6ED8E3B22081A4459DAC7699F3695FB7018CD9700F@SW-EX-MBX02.diasemi.com> References: <1497951359-13334-1-git-send-email-benjamin.gaignard@linaro.org> <1497951359-13334-15-git-send-email-benjamin.gaignard@linaro.org> <6ED8E3B22081A4459DAC7699F3695FB7018CD9700F@SW-EX-MBX02.diasemi.com> From: Benjamin Gaignard Date: Tue, 20 Jun 2017 16:18:06 +0200 Message-ID: Subject: Re: [PATCH 14/51] rtc: da9063: stop using rtc deprecated functions To: Steve Twiss Cc: "linaro-kernel@lists.linaro.org" , Support Opensource , Alessandro Zummo , Alexandre Belloni , "rtc-linux@googlegroups.com" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1820 Lines: 55 2017-06-20 15:41 GMT+02:00 Steve Twiss : > Hi Benjamin, > > On 20 June 2017 10:35, Benjamin Gaignard wrote: > >> Subject: [PATCH 14/51] rtc: da9063: stop using rtc deprecated functions > > Probably this subject should be "rtc: da9052" not 63. yes you are right this patch is for da9052 > >> 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. >> > [...] > >> --- >> drivers/rtc/rtc-da9052.c | 8 +++----- >> 1 file changed, 3 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c >> index 4273377..99a0489 100644 >> --- a/drivers/rtc/rtc-da9052.c >> +++ b/drivers/rtc/rtc-da9052.c >> @@ -104,17 +104,15 @@ static int da9052_read_alarm(struct da9052_rtc >> *rtc, struct rtc_time *rtc_tm) >> static int da9052_set_alarm(struct da9052_rtc *rtc, struct rtc_time *rtc_tm) >> { >> struct da9052 *da9052 = rtc->da9052; >> - unsigned long alm_time; >> + unsigned long long alm_time; >> int ret; >> uint8_t v[3]; >> >> - ret = rtc_tm_to_time(rtc_tm, &alm_time); >> - if (ret != 0) >> - return ret; >> + alm_time = rtc_tm_to_time64(rtc_tm); > > But they kind of use the same functions anyway. > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/rtc.h?h=v4.12-rc6#n35 > And I think they they are abstracted on purpose. > > The DA9052/53 hardware can only handle alarms up to the end of 2063. That is the hardware limits but I don't know if we should align framework functions to for each driver limitation or use 64 bits functions everywhere. but this discussion is on going on another thread... > > Regards, > Steve >