public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtc: rtc-mc146818-lib: Use is_leap_year instead of calculate leap years
@ 2024-10-06  0:15 Nobuhiro Iwamatsu
  2024-10-06  0:58 ` Maciej W. Rozycki
  2024-10-07 13:59 ` Alexandre Belloni
  0 siblings, 2 replies; 4+ messages in thread
From: Nobuhiro Iwamatsu @ 2024-10-06  0:15 UTC (permalink / raw)
  To: alexandre.belloni, linux-rtc, linux-kernel; +Cc: Nobuhiro Iwamatsu

The is_leap_year() for determining leap year is provided in rtc lib.
This uses is_leap_year() instead of its own leap year determination
routine.

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 drivers/rtc/rtc-mc146818-lib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-mc146818-lib.c b/drivers/rtc/rtc-mc146818-lib.c
index 651bf3c279c74..ce4d68de05831 100644
--- a/drivers/rtc/rtc-mc146818-lib.c
+++ b/drivers/rtc/rtc-mc146818-lib.c
@@ -232,8 +232,7 @@ int mc146818_set_time(struct rtc_time *time)
 
 #ifdef CONFIG_MACH_DECSTATION
 	real_yrs = yrs;
-	leap_yr = ((!((yrs + 1900) % 4) && ((yrs + 1900) % 100)) ||
-			!((yrs + 1900) % 400));
+	leap_yr = is_leap_year(yrs + 1900);
 	yrs = 72;
 
 	/*
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-07 23:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-06  0:15 [PATCH] rtc: rtc-mc146818-lib: Use is_leap_year instead of calculate leap years Nobuhiro Iwamatsu
2024-10-06  0:58 ` Maciej W. Rozycki
2024-10-07 13:59 ` Alexandre Belloni
2024-10-07 23:23   ` Nobuhiro Iwamatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox