rtc: pcf2127: improve rtc_read_time() performance
authorHugo Villeneuve <hvilleneuve@dimonoff.com>
Thu, 22 Jun 2023 14:57:44 +0000 (10:57 -0400)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 27 Jul 2023 20:54:51 +0000 (22:54 +0200)
commit31f077c374a8e7cf1960560c0c5e4065048557c0
tree172366149c15ae69b4d2825791058367d69104b5
parent06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
rtc: pcf2127: improve rtc_read_time() performance

Improve performance and readability of rtc_read_time() by reading only
the 7 time registers, instead of reading 8 registers (additional CTRL3
register).

We drop reading of CTRL3 to monitor the low battery flag, as this
check is already available in the ioctl. Anyway, this check only
display an info message and has no other impacts.

The code readability also improves as we do not have to fiddle with
buffer pointer and size arithmetic.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Link: https://lore.kernel.org/r/20230622145800.2442116-2-hugo@hugovil.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-pcf2127.c