RTC changes for 5.15
Alexandre Belloni
maintainerHello Linus,
Here is the RTC subsystem pull request for v5.15 which is very late. I'll try to not make that a habit. The broken down time conversion is similar to what is done in the time subsystem since v5.14. The rest is fairly straightforward.
The following changes since commit e73f0f0ee7541171d89f2e2491130c7771ba58d3:
Linux 5.14-rc1 (2021-07-11 15:07:40 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git tags/rtc-5.15
for you to fetch changes up to 0c45d3e24ef3d3d87c5e0077b8f38d1372af7176:
rtc: rx8010: select REGMAP_I2C (2021-09-09 10:18:40 +0200)
----------------------------------------------------------------
RTC for 5.15
Subsystem:
- Switch to Neri and Schneider time conversion algorithm
Drivers:
- rx8025: add rx8035 support
- s5m: modernize driver and set range
----------------------------------------------------------------
Alexandre Belloni (6):
rtc: s5m: switch to devm_rtc_allocate_device
rtc: s5m: signal the core when alarm are not available
rtc: s5m: enable wakeup only when available
rtc: s5m: set range
rtc: lib_test: add MODULE_LICENSE
rtc: move RTC_LIB_KUNIT_TEST to proper location
Cassio Neri (1):
rtc: Improve performance of rtc_time64_to_tm(). Add tests.
Dmitry Osipenko (1):
rtc: tps65910: Correct driver module alias
Mateusz Jończyk (1):
rtc: cmos: remove stale REVISIT comments
Mathew McBride (2):
rtc: rx8025: implement RX-8035 support
dt-bindings: rtc: add Epson RX-8025 and RX-8035Yu-Tung Chang (1):
rtc: rx8010: select REGMAP_I2C
.../devicetree/bindings/rtc/trivial-rtc.yaml | 3 + drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 2 + drivers/rtc/lib.c | 107 +++++++++++++++------ drivers/rtc/lib_test.c | 81 ++++++++++++++++ drivers/rtc/rtc-cmos.c | 8 +- drivers/rtc/rtc-rx8025.c | 46 ++++++++- drivers/rtc/rtc-s5m.c | 48 ++++----- drivers/rtc/rtc-tps65910.c | 2 +- 9 files changed, 243 insertions(+), 64 deletions(-) create mode 100644 drivers/rtc/lib_test.c
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 3 lines · Alexandre Belloni
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?
Linus
The pull request you sent on Sat, 11 Sep 2021 17:59:18 +0200:
The pull request you sent on Sat, 11 Sep 2021 17:59:18 +0200:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.gittags/rtc-5.15
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/107ccc45bb25c7fdc7a744496caa4d8a52af4812
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
Alexandre Belloni
maintainerQuoted 18 lines · Linus Torvalds
Quoted 3 lines · Alexandre Belloni
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 'inttm_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
Quoted 9 lines
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).
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com