From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-rtc@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [GIT PULL] RTC changes for 5.15
Date: Sat, 11 Sep 2021 21:46:40 +0200 [thread overview]
Message-ID: <YT0HoCMW6nGEnpPL@piout.net> (raw)
In-Reply-To: <CAHk-=wgPJrMhr1_62O2xwD1QbT9oxJJ_uXw2mm6sa0hNDrFuwQ@mail.gmail.com>
On 11/09/2021 10:05:02-0700, Linus Torvalds wrote:
> On Sat, Sep 11, 2021 at 8:59 AM Alexandre Belloni
> <alexandre.belloni@bootlin.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
next prev parent reply other threads:[~2021-09-11 19:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-11 15:59 [GIT PULL] RTC changes for 5.15 Alexandre Belloni
2021-09-11 17:05 ` Linus Torvalds
2021-09-11 19:46 ` Alexandre Belloni [this message]
2021-09-11 17:30 ` pr-tracker-bot
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=YT0HoCMW6nGEnpPL@piout.net \
--to=alexandre.belloni@bootlin.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=torvalds@linux-foundation.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