Received: by 10.192.165.148 with SMTP id m20csp3191346imm; Mon, 23 Apr 2018 02:08:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/MdoI1NIIGJFGGLPlw2O/WOH/K6BPF7oxFkL5q9bJa7h5zVAit3DhReiVO5R1KsQc6zm/g X-Received: by 10.99.117.20 with SMTP id q20mr14904586pgc.88.1524474506584; Mon, 23 Apr 2018 02:08:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524474506; cv=none; d=google.com; s=arc-20160816; b=yt9fo25fRIN2DYSKaC7S30VQ1XDKkQPt46jvsv7Xrp3KpP7kpkgwoeoxooY8/pUExB FVSyhlg5iBPgsycbOPSq9C2OFnkz5TRQ1MJh7gk9Kyg9Bchw8F4npAdZritXmzxjM2YN 1CWV5CQOrsZ8etkrtsFR1jPgm6Kz4QWwN2TUvtL1NFN1i/qD/B7XCEeC76FWaNejd6W6 mKtGYP2+fTsSIcgr18ZfMKm5yrsxNSrNtFcHounPZCSRgn+pZ42J6ZIqbcvUTGtF6enX GMQy2P78mbLDP615X//t/x26VeR7MuPvhmFjbQqqxcEVaXsu8uZmYNxMt1rFqzxHduaZ x+SQ== 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=QVb82WJN5dVUb9V8uylY91YCfhsVVKzh3QpiezQJZUo=; b=cEq6jzsrjiZeN8HpPrnAKCp9zBK1ZRqyOisPh6q0OhO/67+3j4BCplaBBIjmAbg1yc UBIFQLwX/4m+ZJVGXAy3+dEV1ONhE9ZDdNY/naCPHexkfc9sJ2LhUNrLPyW8V0Uf2w5T Hh9d8gTEbxTLR+nR41EYSCqWUb/9k/CcfChonlD4AagbtlK6NLLJ9B5bNqFIqhmNXwBs YRaBJpr6njn3amX3kgFOipleGAOMbR03gJ1j/jwbBg/5ZjZ3HfCP9F/meB8NYfuBqrNb /IZX0trI8n7u7PmYHU0uGpfgWP0rjF3jUSjHJj7RhL6O31IhDHiaRx+bMbDEZNV+SsNQ OYCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=ZG93lRQj; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15si9342114pgr.138.2018.04.23.02.08.12; Mon, 23 Apr 2018 02:08:26 -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=fail header.i=@gmail.com header.s=20161025 header.b=ZG93lRQj; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754379AbeDWJHG (ORCPT + 99 others); Mon, 23 Apr 2018 05:07:06 -0400 Received: from mail-ua0-f193.google.com ([209.85.217.193]:36863 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754223AbeDWJHD (ORCPT ); Mon, 23 Apr 2018 05:07:03 -0400 Received: by mail-ua0-f193.google.com with SMTP id v4so9699986uaj.3 for ; Mon, 23 Apr 2018 02:07:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=QVb82WJN5dVUb9V8uylY91YCfhsVVKzh3QpiezQJZUo=; b=ZG93lRQje6eUb/V89pzw7I4fvPthqi/gk7kQuU2xf7HPoqcK5PGRIeahvo+1DyMMH+ fx1iwgQivV9k1ViodXFRmbZ9vxgiB0I89QmQLEHzxWj6ZSPPpZeQdQWCS5D3hO/6svZS emP8bF7JVctOnlLLff/XfUwRZYRnvoL86vOQizhSgI/GGyBlLNvIcyaXfeVlnZMVk1xC TusXZ67jT6IcPgQUg/qB/KnPu5zz8ufS/qmAZhfdVPna93x9ddKtDCsMJB4UT8/djxcb EwFmY4PgvCGfdFYOEQbTNph+1x/5EBuLA6CaWikPriwOXpyUEuSMv4P2QzgRm1odGJu2 9p6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=QVb82WJN5dVUb9V8uylY91YCfhsVVKzh3QpiezQJZUo=; b=ciVAab+Wfd5WGHDaP9A8KVlRak3vxwIdS1NK3GW1/ydFsAGFuoxuxh+OhO7KIeNTTb HX7cx3ee5CaSAoq3kvohGcaHsvstutAaMsgczlTG772L46bCS2HIavN7XdjZLxZ7m2Fx 92uX4zBXzN4KdtB8V8HmFnH2Z76MYUhAhW56FPVRKwimOgiCMXIo6VjfsTSsARIosKH3 qvMWhMiGLJ2Eoy+w8+oEQOgd85S0YEpLx9u4kDyL78GApcfIDkohVjfv+EOV/GMcSCpQ 9rCGtsWFQBIoYEsk/dR41gIrIyipvcaLNz0/wNb2r+5Mf8jM+5BM+2LDqJ64ZE7nOvhC DN0w== X-Gm-Message-State: ALQs6tCTeqTSXzPUHUYpcEZpTouHNAj86HiTC+V7K9AKfCLFSaf/mhBx dyux/JVXAyN7vLMMCtalCRUgPfbTyhVqqu8vyMw= X-Received: by 10.159.32.72 with SMTP id 66mr15027931uam.72.1524474422248; Mon, 23 Apr 2018 02:07:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.122.68 with HTTP; Mon, 23 Apr 2018 02:07:01 -0700 (PDT) In-Reply-To: References: <0ca46228311ec615947e199def9fed62d70c1f07.1524118799.git.baolin.wang@linaro.org> From: Geert Uytterhoeven Date: Mon, 23 Apr 2018 11:07:01 +0200 X-Google-Sender-Auth: KchIfb5xZSaBmuootlhnUVXjdPA Message-ID: Subject: Re: [PATCH] m68k: Remove read_persistent_clock() To: Arnd Bergmann Cc: Baolin Wang , Alexandre Belloni , Mark Brown , linux-m68k , 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 Hi Arnd, On Fri, Apr 20, 2018 at 5:22 PM, 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. Typically (in the defconfigs) CONFIG_RTC_DRV_GENERIC is either "m", or not set. And in both cases, a platform-specific RTC class driver may or may not be builtin or loaded. We have them for some Amigas (RTC_DRV_MSM6242 or RTC_DRV_RP5C01). I've never been an expert of timekeeping code... Should we get rid of ARCH_USES_GETTIMEOFFSET? it seems m68k and two ARM platforms are the last users. What needs to be done? > See below for a version I did a while ago (but never submitted as I got > distracted). Thanks, I can apply it, if it is deemed correct ;-) > 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) > { Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds