Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751780AbaK1Qtv (ORCPT ); Fri, 28 Nov 2014 11:49:51 -0500 Received: from mail-ig0-f174.google.com ([209.85.213.174]:65364 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751117AbaK1Qtt (ORCPT ); Fri, 28 Nov 2014 11:49:49 -0500 MIME-Version: 1.0 In-Reply-To: <1417089760-26848-3-git-send-email-pang.xunlei@linaro.org> References: <1417089760-26848-1-git-send-email-pang.xunlei@linaro.org> <1417089760-26848-3-git-send-email-pang.xunlei@linaro.org> Date: Sat, 29 Nov 2014 00:49:48 +0800 Message-ID: Subject: Re: [RFC PATCH 2/4] rtc: Convert rtc_class_ops.set_mmss() to use time64_t From: "pang.xunlei" To: lkml Cc: "rtc-linux@googlegroups.com" , Thomas Gleixner , Alessandro Zummo , Sven Schnelle , Xunlei Pang , John Stultz , Arnd Bergmann Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27 November 2014 at 20:02, Xunlei Pang 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 > Cc: Arnd Bergmann > Signed-off-by: Xunlei Pang > > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/