The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Xunlei Pang <pang.xunlei@linaro.org>,
	linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	Sven Schnelle <svens@stackframe.org>,
	John Stultz <john.stultz@linaro.org>,
	Arnd Bergmann <arnd.bergmann@linaro.org>
Subject: Re: [RFC PATCH 2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t
Date: Fri, 28 Nov 2014 00:28:16 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1411280026120.3961@nanos> (raw)
In-Reply-To: <3958728.Cz3JcLN4Uc@wuerfel>

On Fri, 28 Nov 2014, Arnd Bergmann wrote:
> On Friday 28 November 2014 00:05:34 Thomas Gleixner wrote:
> > On Thu, 27 Nov 2014, Xunlei Pang wrote:
> > > -static int coh901331_set_mmss(struct device *dev, unsigned long secs)
> > > +static int coh901331_set_mmss(struct device *dev, time64_t secs)
> > >  {
> > >       struct coh901331_port *rtap = dev_get_drvdata(dev);
> > >  
> > >       clk_enable(rtap->clk);
> > > +     /*
> > > +      * y2106 issue:
> > > +      *   On 32bit systems the time64_t secs value gets cast to
> > > +      *   a 32bit long, and thus we can only write a maximum value
> > > +      *   of y2016
> > 
> > That really makes a lot of sense. Before that patch the driver was
> > safe up to 2038. Now it is facing the y2016 problem.
> 
> Actually the comment is still wrong with the number fixed, I hadn't
> noticed when I looked at the patch earlier:
> 
> The cast happens on both 32-bit and 64-bit, as we cast into a u32
> value through the writel(). The behavior of this driver doesn't
> even change with this patch, it was good until y2106 and stays
> that way because 'unsigned long', 'time64_t' and 'u32' can all represent
> at least times between 1970 and 2106, the change is just to document
> the time at which it will break, while changing the API.

Indeed. I did not bother to think about that as I was already in
grumpy mode due to the general aproach of creating the maximal churn
for no value.
 
Thanks,

	tglx

  reply	other threads:[~2014-11-27 23:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-27 12:02 [RFC PATCH 0/4] Add rtc 64bit epoch offset for rtc hardware that only provides 32bit time Xunlei Pang
2014-11-27 12:02 ` [RFC PATCH 1/4] rtc/mxc: Convert get_alarm_or_time()/set_alarm_or_time() to use time64_t Xunlei Pang
2014-11-27 23:02   ` Thomas Gleixner
2014-11-27 23:47     ` Arnd Bergmann
2014-11-28 15:58       ` pang.xunlei
2014-11-27 12:02 ` [RFC PATCH 2/4] rtc: Convert rtc_class_ops.set_mmss() " Xunlei Pang
2014-11-27 23:05   ` Thomas Gleixner
2014-11-27 23:23     ` Arnd Bergmann
2014-11-27 23:28       ` Thomas Gleixner [this message]
2014-11-28 16:49   ` pang.xunlei
2014-11-27 12:02 ` [RFC PATCH 3/4] rtc/lib: Provide interfaces to map between 32bit hardware and 64bit time Xunlei Pang
2014-11-27 23:16   ` Thomas Gleixner
2014-11-28 16:10     ` pang.xunlei
2014-12-01 21:12       ` Thomas Gleixner
2014-11-27 12:02 ` [RFC PATCH 4/4] rtc/imxdi: Update driver to address time issues Xunlei Pang
2014-11-27 23:24   ` Thomas Gleixner
2014-11-28 16:20     ` pang.xunlei
2014-12-01  0:13       ` Alessandro Zummo

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=alpine.DEB.2.11.1411280026120.3961@nanos \
    --to=tglx@linutronix.de \
    --cc=a.zummo@towertech.it \
    --cc=arnd.bergmann@linaro.org \
    --cc=arnd@arndb.de \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pang.xunlei@linaro.org \
    --cc=rtc-linux@googlegroups.com \
    --cc=svens@stackframe.org \
    /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