Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1475270imm; Sun, 8 Jul 2018 03:50:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcqqXpFt72xpyU73zEzfw6E0v9JITrcTGLxB3EVhlpXb9rwfkRj5AzmLU75Sq2CyB8JhRne X-Received: by 2002:a17:902:8f8e:: with SMTP id z14-v6mr16415098plo.139.1531047040908; Sun, 08 Jul 2018 03:50:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531047040; cv=none; d=google.com; s=arc-20160816; b=JyNGqdTKozx6x1jyNTfiPStb49iqaNiUg5BazQLmHPGfZtbmey2BLvL+k7GP8t9fPY j2g43mcGYmafZ/LZQBdHPm0KSrAMpqmONkVN+p98RNKhHccKsP/lddrBaEssA9PedPlQ r/0DSu9II8VB6L7V0Mi67FwfmYwI6npu5HRejz7fAC2RBvZ9shVa4EnbI06aXi4ZG/HW +U+nyXaC7JshVn9zzL9Ij+Puft/CvA4QBrkGlc0HHWKXiO1Q+mfoie4z60wvhpfy0aX9 o/17Wg8M+oAOPHpmw1/PuRtTlwnPfv9VkFmjp/SRtKVZlj38IsGFwtd/b+0kEeqhNC7w uqzg== 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 :in-reply-to:references:mime-version:arc-authentication-results; bh=l6Xb1ivkbddSChoJrasjZ0NHXotZkPiF0gAy0S/xPfY=; b=Df5U42bJXB/MtZ3bdg2ap7F05H3ial2gtBRyA4xxi/6bAwNqJlJ8e2wz/jdAH8AffO Rk04N+6KeDgvz4Fk8Pd2vn/7/4A6dS2+Yoevo/kh6b0Y2b4ui6WV0e/jTfrAYhjH4Jmj VojR5zJ3Kf+vMB8h4/pqsIXPTI1coRurfJ2IkuzNBIgsD4urbZZwBkeqEzjqb+GHcqk7 7I0cbfM4NMZSggSRBT66vPIXngW6UtZB6YIv1mI2+mdyYkrKaZG/sqwDX0kQbufbPkDz FmT2s7lTHJhRtTSP60lUlFKV0+Fc3GNx8e7NR+xckdWrWB19SFqLe7XFVqUK0i4fzdSV VoVw== ARC-Authentication-Results: i=1; mx.google.com; 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 j63-v6si2457411pgd.425.2018.07.08.03.50.24; Sun, 08 Jul 2018 03:50:40 -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; 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 S932820AbeGHKtn (ORCPT + 99 others); Sun, 8 Jul 2018 06:49:43 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:39820 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932725AbeGHKtm (ORCPT ); Sun, 8 Jul 2018 06:49:42 -0400 Received: by mail-ua0-f195.google.com with SMTP id n4-v6so10071568uad.6 for ; Sun, 08 Jul 2018 03:49:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=l6Xb1ivkbddSChoJrasjZ0NHXotZkPiF0gAy0S/xPfY=; b=d+Zpvp/QcypQV61qlnoc6Jw+UsYNzfUiSIIYutHdrKmliST8ynuwYff5MRlZNbltPY U5SVE6SUGTjgsnDXAhQZueL7f3lNL205skT2RDlVijHottRFDtbJSo3xf5V1pfDTAU8v +dKFyo1ZuQHD9tYBmu2Xfr6Vc9Eoa0z5kTO1ykV8rn5GVgconKj9H0YIc6dnIehPyvdl g8b29hNRqw1YKhQ1q6UP5lSu1NB+4GptkRc+/zZMCgFV+cY2+iX3QHn1DqHVX0ykpZyT EP9dQc6sVvx61ftvzHdk5ASG5cS3lF6zf/HMb165zfaAI1btKbwbHqTXfodbE9mSujAe cdQA== X-Gm-Message-State: APt69E214jLCUInCtydfcumqrlDLWkrpLdqp1pWae8MAP18D6oxskXHR 2xRmMyE+l3j0fhaSWgDRhws+Do2ir19y3Z3Zjj8= X-Received: by 2002:ab0:25d6:: with SMTP id y22-v6mr11057621uan.33.1531046981370; Sun, 08 Jul 2018 03:49:41 -0700 (PDT) MIME-Version: 1.0 References: <20180619140229.3615110-1-arnd@arndb.de> <20180619140229.3615110-2-arnd@arndb.de> In-Reply-To: From: Geert Uytterhoeven Date: Sun, 8 Jul 2018 12:49:29 +0200 Message-ID: Subject: Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling To: Arnd Bergmann Cc: Finn Thain , Paul Mackerras , Michael Ellerman , Joshua Thompson , Mathieu Malaterre , Benjamin Herrenschmidt , Greg Ungerer , linux-m68k , linuxppc-dev , Linux Kernel Mailing List , y2038 Mailman List , Meelis Roos , Andreas Schwab 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, Finn, On Fri, Jun 22, 2018 at 10:55 AM Arnd Bergmann wrote: > On Fri, Jun 22, 2018 at 7:26 AM, Finn Thain wrote: > > On Tue, 19 Jun 2018, Arnd Bergmann wrote: > > > >> The real-time clock on m68k (and powerpc) mac systems uses an unsigned > >> 32-bit value starting in 1904, which overflows in 2040, about two years > >> later than everyone else, but this gets wrapped around in the Linux code > >> in 2038 already because of the deprecated usage of time_t and/or long in > >> the conversion. > >> > >> Getting rid of the deprecated interfaces makes it work until 2040 as > >> documented, and it could be easily extended by reinterpreting the > >> resulting time64_t as a positive number. For the moment, I'm adding a > >> WARN_ON() that triggers if we encounter a time before 1970 or after 2040 > >> (the two are indistinguishable). > >> > > > > I really don't like the WARN_ON(), but I'd prefer to address that in a > > separate patch rather than impede the progress of this patch (or of this > > series, since 3/3 seems to be unrelated). > > > > BTW, have you considered using the same wrap-around test (i.e. YY < 70) > > that we use for the year register in the other RTC chips? > > That wrap-around test would have the same effect as the my original > version (aside from the two bugs I now fixed), doing rougly > > - return time - RTC_OFFSET; > + return (u32)(time - RTC_OFFSET); > > or some other variation of that will give us an RTC that supports all dates > between 1970 and 2106. I don't think anyone so far had a strong > preference here, so I went with what Mathieu suggested and kept the > original Mac behavior, but added the WARN_ON(). So, is this safe to apply? Especially in light of the warnings seen by Meelis with the PPC version. Thanks! 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