rtc: hym8563: Read the valid flag directly instead of caching it
authorPaul Kocialkowski <paul.kocialkowski@bootlin.com>
Thu, 12 Dec 2019 15:31:11 +0000 (16:31 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 23 Dec 2019 10:18:06 +0000 (11:18 +0100)
commite2ed7507ae89b92b67025f221448b543e2333b21
tree525ea891e51431438de58b95a7198efa81fac5f2
parentf236a2a2ebabad0848ad0995af7ad1dc7029e895
rtc: hym8563: Read the valid flag directly instead of caching it

The RTC has a valid bit in the seconds register that indicates whether
power was lost since the pevious time set. This bit is currently read
once at probe time, cached and updated with set_time.

Howeever, caching the bit may prevent detecting power loss at runtime
(which can happen if the RTC's supply is distinct from the the platform's).

Writing the seconds register when setting time will clear the bit,
so there should be no downside in reading the bit directly instead of
caching it.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Link: https://lore.kernel.org/r/20191212153111.966923-2-paul.kocialkowski@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-hym8563.c