Received: by 10.192.165.148 with SMTP id m20csp392355imm; Fri, 20 Apr 2018 08:24:33 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+X0vF4+72hi01BZR8ikKit/V0SzBFTu+OMTPNMXgwcFAz58SVD/tysycajLWs1FCGdgwN+ X-Received: by 2002:a17:902:5389:: with SMTP id c9-v6mr992371pli.143.1524237873477; Fri, 20 Apr 2018 08:24:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524237873; cv=none; d=google.com; s=arc-20160816; b=ZUJR4+gC3n4R0sF4Z5LB+VwUi4PefC1b1pRgGJXQVHuMFKxUzMkW5sUtLRbjt4Ov1U R1TWXXqJhZggYy8tV0OCJWMMUAAEL2DvDEF4G9r6WvBmvbt8g25V+kafebz1M2ENjar0 am8rUdYU/XQVlEd67do9ImvDobCg1x68oAaUmxmrimiFsrHVxB7rwsgGu7CMLyb7GCGc pUcSH8ggmoAEvrFLtNnmdNI3DvyvYNVooFQbajRlnojFPh2/D5Fp2vx16oXmlaMmNUZV Ni18fKrzobevzaIjYKtzUW98baPRMjv0NbfLnkBVFSHmYB93m9KaOl5VY3pbmHb9Fn0r VKDQ== 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=1lL8NrULXcfhSXbGPn1I1mAdCWbpSXgc6J3HBsgHicE=; b=IYQ05+yPRbzfJvQ1MhwUQ8tzhPPNwVHaHVudtHgmzw8J3i3fVA5Ne8Cxh2+NDorPZp YbvDvh5kOX87ELowkrTDU/DzU/rEpXxWJ9TY3myIreKVjLfIh7EsvpBGijv5PLvACEEA GNYqSbsWzl6zrsxU/fxtgZ/INMOdC3lFTG82myAuebA3oO92dFzZLD0WmEubVwzCuDY3 VRZF38gGePlL6xup7o/OfXirOOY/fVs7LfSTmeyVOzg5JMvhV+TcNQY3Rm7YStFjA4Cu 4KZiLVUtg34tkhCaiJjE+m7juRgB9TvSrun+wN/4p/lM2ysfqCPeJSFv9XCeyr6mqLth pNdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=BY8v3BDY; 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 e127si5488249pfc.315.2018.04.20.08.24.18; Fri, 20 Apr 2018 08:24:33 -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=BY8v3BDY; 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 S1755719AbeDTPWx (ORCPT + 99 others); Fri, 20 Apr 2018 11:22:53 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:43757 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755707AbeDTPWv (ORCPT ); Fri, 20 Apr 2018 11:22:51 -0400 Received: by mail-qt0-f195.google.com with SMTP id l11-v6so10075174qtj.10 for ; Fri, 20 Apr 2018 08:22:50 -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=1lL8NrULXcfhSXbGPn1I1mAdCWbpSXgc6J3HBsgHicE=; b=BY8v3BDYiEMDeONFQn7ecbjGsCsSVk0haQfyVkBq3ono47nBmKx76ZoyldsXTc9hYk SV1Bt6goArevzHUjNifzd9sfXpeFRctD9Q7umFJCusSBHI46KpRDopC87FVODY0jizZi KkfDlrcP229YMI6CjPBf79nVnAw0HS5/y3ezrTrHzvX8HbZgNQsJlsu5olZY8tMySIw/ SYNfdo8qYuQS7A+RfLSICsSUjMPsRNH5YZUR9TtcGr2CvAEPUlWKoh1KwNd5yc6RMCvX iODGwaNdPkI25b3407AgZNBChUAB6xy2+NUEvWn16gqCvpsbSJ0/+1xD+HFZvx0RXi1K gJtA== 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=1lL8NrULXcfhSXbGPn1I1mAdCWbpSXgc6J3HBsgHicE=; b=bXVQ/rRgl0Nw7h2NOYMy9nHKwzrQ2O43d5CrdALgUVBCtyGDT87GnZb3qRC6CoFYpe 3JcGsnI73n4YLbsruhOpQGlJJGeFSfWEYkjBaokD7d6UmUIqMBAgbMdBpwdjfqN5bjrk 86ie2OEQ8AZvUOxB381zCDO7xPTzRdNEPpHXnkjT1v25LHYPUb6EEp7rK+er70LcUw/n xJZln0M67phXMOIE1RYSatiU08VrJ21KjA2lCvA8HSKNtBl0i9bLfi9OFeFgJyocF6Rz /zRsVf+KL0r6Q0kgY5/o6lJAQ1xTvAOOv4FShEUB0G/WclAmwVKC5ZNpraZTZMpW4xNP TcAQ== X-Gm-Message-State: ALQs6tAzHmkMIIxA4RmggjvdAjyxSCn/utb7wGyyu6H7SWHuq0+SDp80 1Uv+rYTKKci6CH736t21dzQb51yI3RctFWASAlQ= X-Received: by 2002:ac8:1c12:: with SMTP id a18-v6mr11778746qtk.280.1524237770459; Fri, 20 Apr 2018 08:22:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.185.25 with HTTP; Fri, 20 Apr 2018 08:22:49 -0700 (PDT) In-Reply-To: <0ca46228311ec615947e199def9fed62d70c1f07.1524118799.git.baolin.wang@linaro.org> References: <0ca46228311ec615947e199def9fed62d70c1f07.1524118799.git.baolin.wang@linaro.org> From: Arnd Bergmann Date: Fri, 20 Apr 2018 17:22:49 +0200 X-Google-Sender-Auth: NlqMErMg1pGBLK78KVDUmQBQgnk Message-ID: Subject: Re: [PATCH] m68k: Remove read_persistent_clock() To: Baolin Wang 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 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. 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) {