From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: rtc-mc146818-lib: Use is_leap_year instead of calculate leap years
Date: Mon, 7 Oct 2024 15:59:20 +0200 [thread overview]
Message-ID: <20241007135920ef75da53@mail.local> (raw)
In-Reply-To: <20241006001553.7430-1-iwamatsu@nigauri.org>
Hello,
On 06/10/2024 09:15:53+0900, Nobuhiro Iwamatsu wrote:
> 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);
Could you also eliminate the leap_yr variable?
Thanks!
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2024-10-07 13:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2024-10-07 23:23 ` Nobuhiro Iwamatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241007135920ef75da53@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=iwamatsu@nigauri.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox