aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2024-02-28 00:04:17 +0100
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2024-02-29 22:15:46 +0100
commit4e7a9e2ea2f1fc145a56dff998bc8215525b0a1e (patch)
tree35c6e45a12a743ae97cbd33af689dfbf1916af22 /drivers/rtc
parentf4282a4303dc7eada2543ea9b87e2b9bdec9344b (diff)
downloadlinux-4e7a9e2ea2f1fc145a56dff998bc8215525b0a1e.tar.gz
rtc: ds1511: drop useless computation
All the callers of ds1511_rtc_set_time will use the same epoch for tm_year which is defined as the number of years minus 1900 since POSIX.1-2001. Link: https://lore.kernel.org/r/20240227230431.1837717-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-ds1511.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 87c52d20d31a2..a646bcf9cd56e 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -166,24 +166,13 @@ ds1511_wdog_disable(void)
}
#endif
-/*
- * set the rtc chip's idea of the time.
- * stupidly, some callers call with year unmolested;
- * and some call with year = year - 1900. thanks.
- */
static int ds1511_rtc_set_time(struct device *dev, struct rtc_time *rtc_tm)
{
u8 mon, day, dow, hrs, min, sec, yrs, cen;
unsigned long flags;
- /*
- * won't have to change this for a while
- */
- if (rtc_tm->tm_year < 1900)
- rtc_tm->tm_year += 1900;
-
yrs = rtc_tm->tm_year % 100;
- cen = rtc_tm->tm_year / 100;
+ cen = 19 + rtc_tm->tm_year / 100;
mon = rtc_tm->tm_mon + 1; /* tm_mon starts at zero */
day = rtc_tm->tm_mday;
dow = rtc_tm->tm_wday & 0x7; /* automatic BCD */