linux-stable/drivers
Cassio Neri 1d1bb12a8b rtc: Improve performance of rtc_time64_to_tm(). Add tests.
The current implementation of rtc_time64_to_tm() contains unnecessary
loops, branches and look-up tables. The new one uses an arithmetic-based
algorithm appeared in [1] and is approximately 4.3 times faster (YMMV).

The drawback is that the new code isn't intuitive and contains many 'magic
numbers' (not unusual for this type of algorithm). However, [1] justifies
all those numbers and, given this function's history, the code is unlikely
to need much maintenance, if any at all.

Add a KUnit test case that checks every day in a 160,000 years interval
starting on 1970-01-01 against the expected result. Add a new config
RTC_LIB_KUNIT_TEST symbol to give the option to run this test suite.

[1] Neri, Schneider, "Euclidean Affine Functions and Applications to
Calendar Algorithms". https://arxiv.org/abs/2102.06959

Signed-off-by: Cassio Neri <cassio.neri@gmail.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20210624201343.85441-1-cassio.neri@gmail.com
2021-08-10 00:09:21 +02:00
..
accessibility
acpi More ACPI updates for 5.14-rc1 2021-07-07 13:30:01 -07:00
amba
android
ata ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
atm
auxdisplay
base More power management updates for 5.14-rc1 2021-07-07 13:22:59 -07:00
bcma
block block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
bluetooth
bus ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
cdrom
char ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
clk The second batch of clk driver code for -rc1 2021-07-08 12:12:22 -07:00
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
cxl
dax
dca
devfreq
dio
dma
dma-buf
edac
eisa
extcon
firewire
firmware ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
fpga
fsi
gnss
gpio
gpu drm fixes for 5.14-rc1 2021-07-08 12:28:15 -07:00
greybus
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
i3c I3C for 5.14 2021-07-10 11:53:06 -07:00
idle
iio
infiniband
input This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
interconnect
iommu ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
ipack
irqchip irqchip fixes for 5.14, take #1 2021-07-09 15:35:13 +02:00
isdn
leds
lightnvm
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
most
mtd This pull request contains the following changes for UBIFS: 2021-07-09 10:10:47 -07:00
mux
net ARM: SoC changes for 5.14 2021-07-10 09:22:44 -07:00
nfc
ntb
nubus
nvdimm
nvme block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
nvmem
of
opp
parisc
parport
pci pci-v5.14-fixes-1 2021-07-10 11:57:57 -07:00
pcmcia
perf
phy
pinctrl
platform
pnp
power power supply and reset changes for the v5.14 series 2021-07-07 13:17:48 -07:00
powercap
pps
ps3
ptp
pwm pwm: Remove redundant assignment to pointer pwm 2021-07-07 21:43:32 +02:00
rapidio
ras
regulator
remoteproc remoteproc updates for v5.14 2021-07-07 10:50:03 -07:00
reset ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
rpmsg
rtc rtc: Improve performance of rtc_time64_to_tm(). Add tests. 2021-08-10 00:09:21 +02:00
s390 s390 updates for the 5.14 merge window #2 2021-07-10 10:46:14 -07:00
sbus
scsi SCSI misc on 20210711 2021-07-11 10:59:53 -07:00
sh
siox
slimbus
soc ARM: Drivers for 5.14 2021-07-10 09:46:20 -07:00
soundwire
spi
spmi
ssb
staging
target block-5.14-2021-07-08 2021-07-09 12:05:33 -07:00
tc
tee
thermal - Add rk3568 sensor support (Finley Xiao) 2021-07-10 11:43:25 -07:00
thunderbolt
tty This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
uio
usb
vdpa vp_vdpa: allow set vq state to initial state after reset 2021-07-08 07:49:02 -04:00
vfio
vhost vdpa: support packed virtqueue for set/get_vq_state() 2021-07-08 07:49:01 -04:00
video This pull request contains the following changes for UML: 2021-07-09 10:19:13 -07:00
virt
virtio virtio,vhost,vdpa: features, fixes 2021-07-09 11:06:29 -07:00
visorbus
vlynq
vme
w1
watchdog linux-watchdog 5.14-rc1 tag 2021-07-07 12:57:46 -07:00
xen xen: branch for v5.14-rc1 2021-07-07 11:07:13 -07:00
zorro
Kconfig
Makefile