[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADcy93U6LA0RfX4yKruWpay7eT0qU3p9RvSEmxoupG5KC+u4-Q@mail.gmail.com>
Date: Sat, 29 Nov 2014 00:49:48 +0800
From: "pang.xunlei" <pang.xunlei@...aro.org>
To: lkml <linux-kernel@...r.kernel.org>
Cc: "rtc-linux@...glegroups.com" <rtc-linux@...glegroups.com>,
Thomas Gleixner <tglx@...utronix.de>,
Alessandro Zummo <a.zummo@...ertech.it>,
Sven Schnelle <svens@...ckframe.org>,
Xunlei Pang <pang.xunlei@...aro.org>,
John Stultz <john.stultz@...aro.org>,
Arnd Bergmann <arnd.bergmann@...aro.org>
Subject: Re: [RFC PATCH 2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t
On 27 November 2014 at 20:02, Xunlei Pang <pang.xunlei@...aro.org> wrote:
> Currently the rtc_class_op's set_mmss() function takes a 32bit second
> value (on 32bit systems), which is problematic for dates past y2038.
>
> This patch resolves it by changing the interface and all users to use
> y2038 safe time64_t.
>
> Cc: John Stultz <john.stultz@...aro.org>
> Cc: Arnd Bergmann <arnd.bergmann@...aro.org>
> Signed-off-by: Xunlei Pang <pang.xunlei@...aro.org>
>
> diff --git a/drivers/rtc/rtc-ds2404.c b/drivers/rtc/rtc-ds2404.c
> index fc209dc..ec50757 100644
> --- a/drivers/rtc/rtc-ds2404.c
> +++ b/drivers/rtc/rtc-ds2404.c
> @@ -210,9 +210,16 @@ static int ds2404_read_time(struct device *dev, struct rtc_time *dt)
> return rtc_valid_tm(dt);
> }
>
> -static int ds2404_set_mmss(struct device *dev, unsigned long secs)
> +static int ds2404_set_mmss(struct device *dev, time64_t secs)
> {
> + /*
> + * 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
> + */
> u32 time = cpu_to_le32(secs);
> +
> ds2404_write_memory(dev, 0x203, 4, (u8 *)&time);
Hi Sven,
Does this rtc hardware support ds2404_write_memory() with length > 4,
i.e. y2106 safe?
Thanks,
Xunlei
> return 0;
> }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists