Re: [PATCH v2 2/2] rtc: hym8563: Read the valid flag directly instead of caching it

From: Alexandre Belloni
Date: Mon Dec 23 2019 - 05:18:55 EST


On 12/12/2019 16:31:11+0100, Paul Kocialkowski wrote:
> 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@xxxxxxxxxxx>
> ---
> Changes since v1:
> - Removed hym8563 unused variables;
> - Checked buf[0] for VL flag instead of ret;
> - Reorded patches.
>
> drivers/rtc/rtc-hym8563.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com