Received: by 10.192.165.148 with SMTP id m20csp2914361imm; Sun, 22 Apr 2018 19:09:43 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/aA62+vQBlp3qKN+R5mIRD2PLJBxXi/YjsluDVXPJb+JBOT4zolu3IY7w75axH8qotwwxy X-Received: by 10.98.102.221 with SMTP id s90mr14645364pfj.123.1524449383272; Sun, 22 Apr 2018 19:09:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524449383; cv=none; d=google.com; s=arc-20160816; b=fGhqBMAGpWEOX9hyJeYc3oT1ZWAyQp3mUxbucx9GnUfOW5SU6j9yKmHN9B8A5P8xe/ 3fAnlm28DDiDqh7+da3d6e+k08Q0OqPnqX1CLivA74AoweH4ZHK9EsfrsS7Wew/V2xJO lIXEMcd5b7AYL8CQQNA0LGxO125IjClKmMveDkXw4SZ6wahwG4YB4wIdmHsVP245pQtx IfV2lv0kALtEBRc+BKQR1hrzaRylKixNc8P0zFazSGKeyWigk7QNYyQDYhE2Yd6WKoE2 DCWGrdaMI7UICm/ZVU3rcOrOO3PpFZi7v742tRYt8WG2KJnNst/h4c14uOq/oBFHTkEJ qHew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=CC672zvHiNp/R5EAbFgemA0SYHI03wJWdZbMS+9qWVI=; b=YUWFTy++p9yB/LwyU73Ql1v1dvTd1ejDEYh/bAOu+hKwuCv6qFmRRfRh7QrH/QcdV/ Gbec5SC5ivMIVMBRqMApXst027wHUR1UdRRQcebPk2xPK4Fhih4muYuFws0Q2gJGAdVs +M/eMZ1iYa/9dl4nsL4Z+Wx/IStDGI99hdZ3oNGH3Fwhz/rHBb+knV6LwpejXzsyJC0V jagr9oQTvelGItd124NFpKz8oucb/xDKXAH3EgrLWwevGiwuXFhZ1REW+Faaj1MJHCRH BJe1BkLLyo1ZOmCnYrVVuJoQXFw1p38INKzGC0ZX2HPgW6qACSamJ8dZg+RUGO87b03i hkuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f28l9DLc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6-v6si11708518plp.18.2018.04.22.19.09.28; Sun, 22 Apr 2018 19:09:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f28l9DLc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753877AbeDWCIZ (ORCPT + 99 others); Sun, 22 Apr 2018 22:08:25 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:39026 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753648AbeDWCIY (ORCPT ); Sun, 22 Apr 2018 22:08:24 -0400 Received: by mail-ot0-f196.google.com with SMTP id a14-v6so15519719otf.6 for ; Sun, 22 Apr 2018 19:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=CC672zvHiNp/R5EAbFgemA0SYHI03wJWdZbMS+9qWVI=; b=f28l9DLcSqUQ3Y9b9epcj8G/5cGmj6PQ44xuc0Jm4X0jh2sKaPl12fucb+ssV/PWDe 8DphOn7xji8eRr+ztffxRV1lp4m3yDiCnqXgQAGb+vUSgOtLa98fmK+Zn5+surY//L1l vWnwqwIE2CnC+dxKsE18/68i6QGYPzXkqFvAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=CC672zvHiNp/R5EAbFgemA0SYHI03wJWdZbMS+9qWVI=; b=QHPp8goSJjiVk34XtrlaWXGkYXAcL03HvV9CiYtDBjQpO2CVyroAVEAtO5TNRMk9CI qTaI6vNWWWmQoDIoG5Wom/mhot8MBAaQwtzbuRjQRJPfy6Z2xJVZcZGIQiQQCzSsAyu5 5Td0A0p0snNe/AGwORT3V2vRq1pkVnQYOIhI2cTZi4/UBjhteOFKyD3quh8QAW8aPwFE T/FdUs+ctcTVBU3z9jFUZSdTJc3oN+4d9EusajQ/mlA//34OhxY+1okS4HwJTMP+yA6r d5yWGp44S5ze+Pt/cHtq2V7oWFjJHcsUHAPZBMzGuvDzfHqIPKSNjULiRPJHnBPCKwhn i2YQ== X-Gm-Message-State: ALQs6tC17Z6a78tDSq6TwXsnrlkYsq1Prlg4T7Wu9IYoo51w49e02AEB x+aZDSGM4xjslPG8QNuvSQ0HNCLn4zr+579A+mzSqWNC X-Received: by 2002:a9d:cb9:: with SMTP id b54-v6mr13010892otb.249.1524449303511; Sun, 22 Apr 2018 19:08:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2d77:0:0:0:0:0 with HTTP; Sun, 22 Apr 2018 19:08:23 -0700 (PDT) In-Reply-To: References: <0ca46228311ec615947e199def9fed62d70c1f07.1524118799.git.baolin.wang@linaro.org> From: Baolin Wang Date: Mon, 23 Apr 2018 10:08:23 +0800 Message-ID: Subject: Re: [PATCH] m68k: Remove read_persistent_clock() To: Arnd Bergmann Cc: Geert Uytterhoeven , Alexandre Belloni , Mark Brown , linux-m68k@lists.linux-m68k.org, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20 April 2018 at 23:22, Arnd Bergmann wrote: > On Thu, Apr 19, 2018 at 8:22 AM, Baolin Wang wrote: >> The read_persistent_clock() uses a timespec, which is not year 2038 safe >> on 32bit systems. Moreover on m68k architecture, we have implemented generic >> RTC drivers that can be used to compensate the system suspend time. So >> we can remove the obsolete read_persistent_clock(). >> >> Signed-off-by: Baolin Wang > > I'm not sure about this one: it's still possible to turn off > CONFIG_RTC_DRV_GENERIC > on M68KCLASSIC, and in that case we still need a read_persistent_clock64() > implementation. Or we use your patch but make CONFIG_RTC_DRV_GENERIC > mandatory. OK. Thanks for fixing the issue with your patch. > > See below for a version I did a while ago (but never submitted as I got > distracted). > > Arnd > > commit 13ddf5a33a195e9b7a7a6ed10481363b5259c1d4 > Author: Arnd Bergmann > Date: Thu Jan 25 15:30:50 2018 +0100 > > m68k: use read_persistent_clock64 consistently > > We have two ways of getting the current time from a platform at boot > or during suspend: either using read_persistent_clock() or the rtc > class operation. We never need both, so I'm hiding the > read_persistent_clock variant when the generic RTC is enabled. > > Since read_persistent_clock() and mktime() are deprecated because of > the y2038 overflow of time_t, we should use the time64_t based > replacements here. > > Finally, the dependency on CONFIG_ARCH_USES_GETTIMEOFFSET looks > completely bogus in this case, so let's remove that. It was > added in commit b13b3f51ff7b ("m68k: fix inclusion of > arch_gettimeoffset for non-MMU 68k classic CPU types") to deal > with arch_gettimeoffset(), which has since been removed from > this file and is unrelated to the RTC functions. > > The rtc accessors are only used by classic machines, while > coldfire uses proper RTC drivers, so we can put the old > ifdef back around both functions. > > Signed-off-by: Arnd Bergmann > > diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c > index 97dd4e26f234..edcf3855d8b0 100644 > --- a/arch/m68k/kernel/time.c > +++ b/arch/m68k/kernel/time.c > @@ -71,7 +71,9 @@ static irqreturn_t timer_interrupt(int irq, void *dummy) > return IRQ_HANDLED; > } > > -void read_persistent_clock(struct timespec *ts) > +#ifdef CONFIG_M68KCLASSIC > +#if !IS_BUILTIN(CONFIG_RTC_DRV_GENERIC) > +void read_persistent_clock64(struct timespec64 *ts) > { > struct rtc_time time; > ts->tv_sec = 0; > @@ -82,12 +84,13 @@ void read_persistent_clock(struct timespec *ts) > > if ((time.tm_year += 1900) < 1970) > time.tm_year += 100; > - ts->tv_sec = mktime(time.tm_year, time.tm_mon, time.tm_mday, > + ts->tv_sec = mktime64(time.tm_year, time.tm_mon, time.tm_mday, > time.tm_hour, time.tm_min, time.tm_sec); > } > } > +#endif > > -#if defined(CONFIG_ARCH_USES_GETTIMEOFFSET) && > IS_ENABLED(CONFIG_RTC_DRV_GENERIC) > +#if IS_ENABLED(CONFIG_RTC_DRV_GENERIC) > static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm) > { > mach_hwclk(0, tm); > @@ -145,8 +148,8 @@ static int __init rtc_init(void) > } > > module_init(rtc_init); > - > -#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */ > +#endif /* CONFIG_RTC_DRV_GENERIC */ > +#endif /* CONFIG M68KCLASSIC */ > > void __init time_init(void) > { -- Baolin.wang Best Regards