From: Finn Thain <fthain@telegraphics.com.au>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Joshua Thompson <funaho@jurai.org>,
Mathieu Malaterre <malat@debian.org>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Greg Ungerer <gerg@linux-m68k.org>,
linux-m68k <linux-m68k@lists.linux-m68k.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
y2038 Mailman List <y2038@lists.linaro.org>,
Meelis Roos <mroos@linux.ee>,
Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling
Date: Wed, 18 Jul 2018 23:49:20 +1000 (AEST) [thread overview]
Message-ID: <alpine.LNX.2.21.1807182333150.41@nippy.intranet> (raw)
In-Reply-To: <CAK8P3a0OBVu-o6kFCS=gV83EcH9ba9QYGZBBhB9D8cJrf=8akA@mail.gmail.com>
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;
?
--
next prev parent reply other threads:[~2018-07-18 13:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-19 14:02 [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions Arnd Bergmann
2018-06-19 14:02 ` [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling Arnd Bergmann
2018-06-22 5:26 ` Finn Thain
2018-06-22 8:54 ` Arnd Bergmann
2018-07-08 10:49 ` Geert Uytterhoeven
2018-07-08 11:45 ` Finn Thain
2018-07-18 11:36 ` Geert Uytterhoeven
2018-07-18 12:02 ` Finn Thain
2018-07-18 12:20 ` Arnd Bergmann
2018-07-18 13:49 ` Finn Thain [this message]
2018-07-18 14:26 ` Arnd Bergmann
2018-07-22 11:56 ` Finn Thain
2018-07-23 8:08 ` Geert Uytterhoeven
2018-06-19 14:02 ` [PATCH 3/3] [v2] m68k: remove unused set_clock_mmss() helpers Arnd Bergmann
2018-07-18 11:37 ` Geert Uytterhoeven
2018-06-20 7:16 ` [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions Mathieu Malaterre
2018-07-01 15:47 ` Meelis Roos
2018-07-09 21:31 ` Arnd Bergmann
2018-07-10 1:18 ` Finn Thain
2018-06-27 4:32 ` Michael Ellerman
2018-06-27 10:36 ` Arnd Bergmann
2018-06-27 12:41 ` Michael Ellerman
2018-06-27 21:41 ` [1/3,v2] " Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.21.1807182333150.41@nippy.intranet \
--to=fthain@telegraphics.com.au \
--cc=arnd@arndb.de \
--cc=benh@kernel.crashing.org \
--cc=funaho@jurai.org \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=malat@debian.org \
--cc=mpe@ellerman.id.au \
--cc=mroos@linux.ee \
--cc=paulus@samba.org \
--cc=schwab@linux-m68k.org \
--cc=y2038@lists.linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).