OSDN Git Service

rtc: stm32: use the proper register sequence to read date/time
authorAntonio Borneo <antonio.borneo@foss.st.com>
Wed, 5 Jul 2023 17:43:51 +0000 (19:43 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 27 Jul 2023 21:03:33 +0000 (23:03 +0200)
commitf69cb2d6034ddf8dae6848d29b9d4efba8cd4df9
tree13957ce0abae3412caa8cd0c9dfb8ad02fc9281d
parent2080e08460c41c6d432575132868fdf076768c92
rtc: stm32: use the proper register sequence to read date/time

Date and time are read from two separate RTC registers.
To ensure consistency between the two registers, reading the time
register locks the values in the shadow date register until the
date register is read.
Thus, the whole date/time read requires reading the time register
first, followed by reading the date register.
If the reads are done in reversed order, the shadow date register
will remain locked until a future read operation. The future read
will read the former date value that could be already invalid.

Fix the read order of date/time registers in stm32_rtc_valid_alrm()

Signed-off-by: Antonio Borneo <antonio.borneo@foss.st.com>
Signed-off-by: Valentin Caron <valentin.caron@foss.st.com>
Link: https://lore.kernel.org/r/20230705174357.353616-2-valentin.caron@foss.st.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-stm32.c