Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp551460imm; Wed, 18 Jul 2018 06:50:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfg4wv4X00+7CKpxLKdRSdDXPjfKxXZp+bcxfn1KBR2+0wazXnVElVsy3DD23VbRrVHaM2q X-Received: by 2002:a63:4663:: with SMTP id v35-v6mr5739527pgk.178.1531921859337; Wed, 18 Jul 2018 06:50:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531921859; cv=none; d=google.com; s=arc-20160816; b=NEGzIYdaqFXAKM40L0PqNiJOihKdQMDfW/r41K8jK4bMrXduvU5dl5Auag7WWhPL0o Tu/5IVCrpINczG9P+mpV6ZG3FAAM0HaJizaVUB2iQTOhRTgDrnHdefEjhjYYm26EEkkl OZDpt/uFxEUsSGwxOSiGGranbcYEPDXZ4pZyaB3I6GYQQX7IasomdT00x5iwQo5NvM+e cgAQFr6v4FJj39xyk5B4R86k3Lr+s4T6lrOZ+6y58SBFAre3vDiPJOgY720G8f1+Snf6 IIIO0iZToyzTljilD+cG4g52sbvSJoY/acP5RF87WR2RaG0o6v1eAyAGpSmKWlZhqWV2 7M6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date:arc-authentication-results; bh=yyYg0drqVknXoi0Yx1Uzbot15SLa1KXgddsnY1flERc=; b=VCg6VqjNh9PCEc2zF6VadhLKGgPk8dTOm32kym+aMwJnFT2OjRgdkF3/UbEymoqirs mx22TPJgfDmfxei+8p7jhDVEbOa5pTZ8r0oXL8mnq7FHS1mF8T7thS9ty120KetFP7rT JnPUyYREIUkhF4K3vuWyDt3vGLigNyjYxuRmr/5Ax3XnLhRmuNpRLpfVCwP99uSvJ8Nb GlC+2CMdJFrKsxoRY0TDOx0l2bxlCeA1Tkt7up43trXxkhOJp1FrelT8TAqEx9kEubKN IcupZp5sTh/+yeunFxfH/8S6CxadoRzP8yvvikGsVQ37Z/Q6bj4IJ1jLXqeNvTDN3QO2 nL+Q== 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 o1-v6si3041812pld.424.2018.07.18.06.50.44; Wed, 18 Jul 2018 06:50:59 -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 S1731340AbeGRO12 (ORCPT + 99 others); Wed, 18 Jul 2018 10:27:28 -0400 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:38956 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731128AbeGRO12 (ORCPT ); Wed, 18 Jul 2018 10:27:28 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id CF07423F11; Wed, 18 Jul 2018 09:49:21 -0400 (EDT) Date: Wed, 18 Jul 2018 23:49:20 +1000 (AEST) From: Finn Thain To: Arnd Bergmann cc: Geert Uytterhoeven , 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 Subject: Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling In-Reply-To: Message-ID: References: <20180619140229.3615110-1-arnd@arndb.de> <20180619140229.3615110-2-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 18 Jul 2018, Arnd Bergmann wrote: > Hmm, apparently I forgot to update via_read_time(), that one > is indeed bogus and now inconsistent with the other functions. > > The change in via_write_time() seems at least consistent wtih what we do > elsewhere, and using __u32 makes this code more portable. (yes, I > realize that 64-bit powermac doesn't use the VIA RTC, but it feels > better to write code portably anyway). > As for portability, I think you just contradicted yourself. But I take your point about consistency. So I won't object to adopting __u32. > I'd suggest we do it like below to make it consistent with the > rest again, using the 1904..2040 range of dates and no warning > for invalid dates. > > If you agree, I'll send that as a proper patch. > Geert may instead wish to fixup or revert the patch he has committed already... > Arnd > > diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c > index bf8df47a6d09..8335509969f1 100644 > --- a/arch/m68k/mac/misc.c > +++ b/arch/m68k/mac/misc.c > @@ -255,12 +255,13 @@ static void via_write_pram(int offset, __u8 data) > * is basically any machine with Mac II-style ADB. > */ > > -static long via_read_time(void) > +static time64_t via_read_time(void) > { > union { > __u8 cdata[4]; > - long idata; > + __u32 idata; > } result, last_result; > + time64_t ret; ret isn't used. > int count = 1; > > via_pram_command(0x81, &last_result.cdata[3]); > @@ -279,12 +280,8 @@ static long via_read_time(void) > via_pram_command(0x89, &result.cdata[1]); > via_pram_command(0x8D, &result.cdata[0]); > > - if (result.idata == last_result.idata) { > - if (result.idata < RTC_OFFSET) > - result.idata += 0x100000000ull; > - > - return result.idata - RTC_OFFSET; > - } > + if (result.idata == last_result.idata) > + return (time64_t(result.idata) - RTC_OFFSET); > Did you mean to write, return (time64_t)result.idata - RTC_OFFSET; ? --