]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rtc: rzn1: fix BCD to rtc_time conversion errors
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Wed, 13 Nov 2024 11:30:32 +0000 (12:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 13:03:05 +0000 (14:03 +0100)
commitc5b75986dbae69f58cab94f05d2d28a24f3b2c34
tree86d5ca518035ed96524ee9b40fb94a75a8df37fd
parent2cdb416de8b5795fd25fadcb69e1198b6df6d8cc
rtc: rzn1: fix BCD to rtc_time conversion errors

[ Upstream commit 55727188dfa3572aecd946e58fab9e4a64f06894 ]

tm_mon describes months from 0 to 11, but the register contains BCD from
1 to 12. tm_year contains years since 1900, but the BCD contains 20XX.
Apply the offsets when converting these numbers.

Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20241113113032.27409-1-wsa+renesas@sang-engineering.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-rzn1.c