Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752862AbbFATn6 (ORCPT ); Mon, 1 Jun 2015 15:43:58 -0400 Received: from mout.kundenserver.de ([212.227.17.10]:53166 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750812AbbFATnt (ORCPT ); Mon, 1 Jun 2015 15:43:49 -0400 From: Arnd Bergmann To: pang.xunlei@zte.com.cn Cc: Alexandre Belloni , Alessandro Zummo , Andrew Christian , CIH , John Stultz , linux-kernel@vger.kernel.org, Nicolas Pitre , Xunlei Pang , Richard Purdie , rtc-linux@googlegroups.com, Xunlei Pang Subject: Re: [5/5] drivers/rtc/sa1100: Replace deprecated rtc_tm_to_time() and rtc_time_to_tm() Date: Mon, 01 Jun 2015 21:43:22 +0200 Message-ID: <3404495.679z0IaaBp@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1429089611-29776-5-git-send-email-xlpang@126.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:21bABXGT1VQHHLymqnp79M/Q6Lg4GumjzW0k4bbWlBhKLLg+8Ul K+C18pEdv9jlUPtKQIXuLK8CLvdQfKqPntCQmy2XVh2GGHrSoPV8rzaHyZtwip41mU4PLZH WSR9hK8pivutx2chE77lbLuc0VXgxOAzn61sOeWSFnsePJxNSQJ0wSACqlQG1KmNhqv9r5b oOMumzhlTAuPk+CqUxFBg== X-UI-Out-Filterresults: notjunk:1;V01:K0:VNZl91EOmrc=:ZSqUUCOUnq/hgmzGunwh30 1UomvK18vvhLhx+nGxTo0Y3kl1rYhW+9sETRWtdsJCpljih2WLShNH+QkFzusWD28LbpbqPnr ltrmAZZfodCiZLTqkR1MFTM4S34WiEVpmd/TsH7EOvW/Wypgy+JAg8B1QEpwIhfOLZnuByeZx 66wg/pG0CMG+Et/UY6dIVPePdGUl6QOUVRlguMWvG121pwgO5y3wEv0B6M/p0uANDpb031EOd z/WPO23+ReKmVe3SyS45Oqyiey61wAuUbHAStIV88jeOM5jFHMhcSqhRF8044P+eNxhlG1hxW /6BYtXjAPzStOsgv+VgwfgUkeWr5A2j3F0qj0TgEJ2lhSpsMnsLQScc2Ax9vvy1239MkrbHPN CngYzMaZyl+0y9QJ3D4dpGYE8u7fx+UFUc4SGgz4diACRdBONQEOAyUoIYdMo7RoN8rOi6wvM aeUo8nku9NooPMDZ28L2x04Iy4SkVo9is2kV9gopH25RSa0/lvaMmXCdYbn5hzvXTjSR1iA8u W7KFTq7IEJ9JOffziDHkcYz4kjqXnHvE+MbOti6AcJL64dzJzFMWSdvIakhpnUdnJTAUyJK/Y oDM1P7Uea9YYdzYfq+CvFGFJ+9xsvGryMCsGT3CFi6o2UjLU8hDW3rmgeAhbffmmO08E6Tdf4 2vFbh0bXUoDax3EFa09ofdzziYHR8fWMDxSU/F050Zzl8Sg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2354 Lines: 59 On Saturday 30 May 2015 18:05:10 pang.xunlei@zte.com.cn wrote: > PangXunLei10110855/user/zte_ltd wrote 2015-05-29 PM 10:32:15: > > Alexandre Belloni wrote > > 2015-04-30 AM 07:28:24: > > > Re: [5/5] drivers/rtc/sa1100: Replace deprecated rtc_tm_to_time() > > > and rtc_time_to_tm() > > > > > > For the same reason that Russell pointed in patch 4/5, this hides that > > > it doesn't work after 2106-02-07 06:28:16 as the register is still 32 > > > bits. > > > I would prefer that you return an error in that case. > > > > Thanks for the review, I want to leave the ones like this untouched. > > > > To further explain, for the rtc hardware with 32-bit counters, we actually > > had a solution before: https://lkml.org/lkml/2014/11/27/341 > > But seems some guys don't like the solution, so rtc drivers like this one > can't be simply changed to use the new-added y2038-safe interfaces. > > Maybe those drivers will still retain the deprecated interfaces until a > better solution is proposed. Note that Alexandre has stepped up as a new maintainer for RTC now, so whatever he wants is probably the way it should be done. I think the way that your first approach came out was a bit unfortunate, because we didn't have agreement on how it should really be done. IMHO the rtc_time64_to_hw32 and rtc_hw32_to_time64 interfaces were a good concept, most importantly so we can easily find where the potential problems are, but the implementation was a bit too ambitious in trying to fix the underlying issue. If we want to start this over again, I think a better approach would be to introduce trivial functions at first, like time64_t rtc_hw32_to_time64(u32 hwtime) { /* * this is safe until about 2106, when unsigned u32 seconds from the * 1970 epoch will overflow */ return (u64)hwtime; } EXPORT_SYMBOL_GPL(rtc_hw32_to_time64); This way, we can fix all the drivers without introducing any possible ambiguity and later decide how that function should in fact handle the 2106 overflow. Our grandchildren can take care of that if necessary ;-) Arnd -- 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/