[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YT0HoCMW6nGEnpPL@piout.net>
Date: Sat, 11 Sep 2021 21:46:40 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-rtc@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [GIT PULL] RTC changes for 5.15
On 11/09/2021 10:05:02-0700, Linus Torvalds wrote:
> On Sat, Sep 11, 2021 at 8:59 AM Alexandre Belloni
> <alexandre.belloni@...tlin.com> wrote:
> >
> > The broken down time conversion is similar to what is done
> > in the time subsystem since v5.14.
>
> By "similar" you mean "identical", no?
>
> Why is the rtc subsystem not just using the generic time64_to_tm()?
>
> Yes, yes, I realize that due to historical mistakes, there's a
> duplicate 'struct rtc_time' struct, but it turns out that that is
> _identical_ to 'struct tm' except it also has a 'int tm_isdst' at the
> end.
>
> So you could literally make a union of the two, pass the 'struct tm'
> part down to the generic code, and just do
>
> rtc_tm->tm_isdst = 0;
>
> at the end.
>
> Rather than have a duplicate copy of that admittedly clever Neri and
> Schneider algorithm.
>
> Hmm?
>
Yes, most of it is historical, I did have a look at removing the copy
but at the time, rtc_time64_to_tm was slightly more efficient because
it knew the time was positive.
The other issue is that struct rtc_time is exposed to userspace while
the kernel struct tm is not and this would tie both struct and if you
look close enough, struct tm has long tm_year and struct rtc_time has
int tm_year which on 32-bit ARM has a different size.
I've been reluctant to change struct tm because I didn't take the time
to check the impact on all the users (IIRC, mainly in filesystems).
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists