Linux RTC
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	"john.stultz@linaro.org" <john.stultz@linaro.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"sboyd@codeaurora.org" <sboyd@codeaurora.org>,
	"shuah@kernel.org" <shuah@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	"a.zummo@towertech.it" <a.zummo@towertech.it>,
	"alexandre.belloni@free-electrons.com"
	<alexandre.belloni@free-electrons.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>
Cc: "linaro-kernel@lists.linaro.org" <linaro-kernel@lists.linaro.org>
Subject: [rtc-linux] Re: [PATCH 3/3] rtc: st-lpc: make it robust against y2038/2106 bug
Date: Mon, 19 Jun 2017 07:57:48 +0000	[thread overview]
Message-ID: <ba0475d6-b386-9bb9-0b3b-5a4568633e62@st.com> (raw)
In-Reply-To: <1497621833-9942-4-git-send-email-benjamin.gaignard@linaro.org>

Hi Benjamin

On 06/16/2017 04:03 PM, Benjamin Gaignard wrote:
> Make driver use u64 variables and functions to be sure that
> it will support dates after year 2038.
> 
> Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
> ---
>   drivers/rtc/rtc-st-lpc.c | 19 ++++++++-----------
>   1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-st-lpc.c b/drivers/rtc/rtc-st-lpc.c
> index 74c0a33..82b0af1 100644
> --- a/drivers/rtc/rtc-st-lpc.c
> +++ b/drivers/rtc/rtc-st-lpc.c
> @@ -99,7 +99,7 @@ static int st_rtc_read_time(struct device *dev, struct rtc_time *tm)
>   
>   	lpt = ((unsigned long long)lpt_msb << 32) | lpt_lsb;
>   	do_div(lpt, rtc->clkrate);
> -	rtc_time_to_tm(lpt, tm);
> +	rtc_time64_to_tm(lpt, tm);
>   
>   	return 0;
>   }
> @@ -107,13 +107,10 @@ static int st_rtc_read_time(struct device *dev, struct rtc_time *tm)
>   static int st_rtc_set_time(struct device *dev, struct rtc_time *tm)
>   {
>   	struct st_rtc *rtc = dev_get_drvdata(dev);
> -	unsigned long long lpt;
> -	unsigned long secs, flags;
> -	int ret;
> +	unsigned long long lpt, secs;
> +	unsigned long flags;
>   
> -	ret = rtc_tm_to_time(tm, &secs);
> -	if (ret)
> -		return ret;
> +	secs = rtc_tm_to_time64(tm);
>   
>   	lpt = (unsigned long long)secs * rtc->clkrate;
>   
> @@ -161,13 +158,13 @@ static int st_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *t)
>   {
>   	struct st_rtc *rtc = dev_get_drvdata(dev);
>   	struct rtc_time now;
> -	unsigned long now_secs;
> -	unsigned long alarm_secs;
> +	unsigned long long now_secs;
> +	unsigned long long alarm_secs;
>   	unsigned long long lpa;
>   
>   	st_rtc_read_time(dev, &now);
> -	rtc_tm_to_time(&now, &now_secs);
> -	rtc_tm_to_time(&t->time, &alarm_secs);
> +	now_secs = rtc_tm_to_time64(&now);
> +	alarm_secs = rtc_tm_to_time64(&t->time);
>   
>   	/* Invalid alarm time */
>   	if (now_secs > alarm_secs)
> 

Acked-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  parent reply	other threads:[~2017-06-19  7:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 14:03 [PATCH 0/3] rtc: make st-lpc robust against y2038/2106 bug Benjamin Gaignard
2017-06-16 14:03 ` [PATCH 1/3] tools: timer: add rtctest_setdate Benjamin Gaignard
2017-06-16 15:34   ` [rtc-linux] " Alexandre Belloni
2017-06-16 14:03 ` [rtc-linux] [PATCH 2/3] tools: timer: add test to check y2038/2106 bug Benjamin Gaignard
2017-06-16 14:03   ` Benjamin Gaignard
2017-06-16 15:52   ` Alexandre Belloni
2017-06-16 14:03 ` [rtc-linux] [PATCH 3/3] rtc: st-lpc: make it robust against " Benjamin Gaignard
2017-06-16 14:03   ` Benjamin Gaignard
2017-06-19  7:57   ` Patrice CHOTARD [this message]
2017-06-16 15:19 ` [rtc-linux] Re: [PATCH 0/3] rtc: make st-lpc " Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba0475d6-b386-9bb9-0b3b-5a4568633e62@st.com \
    --to=patrice.chotard@st.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=john.stultz@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=sboyd@codeaurora.org \
    --cc=shuah@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox