]> git.hungrycats.org Git - linux/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 12:54:28 +0000 (13:54 +0100)
commitef92f44efa22f8f1224365e49fc3febb051d1b51
treeffedc52731aa0661532d7b026b0f9bc0ba1866d7
parent4844e462ca96e5e35c885a24ab34825d6cda61f6
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