From nobody Sun Feb 8 16:33:48 2026 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03A9B2D1913 for ; Fri, 23 Jan 2026 08:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769155743; cv=none; b=FV31rwHrj5NulhEffKFOWSwKifQFIS0Z7tfvO2EFn98aua+xabddV1JL+FLQFLa817U8Oe6Rl3jog3W9Prlfd92SfsYIcuMku1BdUYi1Jpkrr5zEhqw5ng/sx+jzchBpaO5hji1XHUf8PrBwX1iSLjtV3Cfk4oZ7fs1A0SzeC6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769155743; c=relaxed/simple; bh=7Uq6ag/DHsJmDjNv8fz00QBcctPRLbtXcc4yl7SNTSg=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=oxb6XJeBkiSVBVs+sRauH3LgmchY29KQotDGYuAwmJnMNHSW0cZ8tw+O+ITUlLE+FB6UP6H4Fcu30mCs1hBtezAqnq5YjwfRm04vqGxfLJW9wQiifKCfvT6tVcsNZgjvoJyguatwBdJj6uaiWi15veX+7wRZkTEV00y/7Q2d4Ec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=hfKoB7bm; arc=none smtp.client-ip=113.46.200.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="hfKoB7bm" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=3b3g8lhL7I0ZobPfe7Yegic+cU8UZSBy8L7KWPV8VL0=; b=hfKoB7bmmhaqPifcM4DPB/bYc8Wo2zKaQpG1VhjNIOM6OWel85nNrFaEifQoE6yEwAuCOWbiV 3l5RLIDK49O7t4Xp806JzA5cggBwE/DogniYFd9x3atfnE6tehHSZQuebnmNv8dA4jubZwRixrj FKTaCYBOriAboePCLvdA3No= Received: from mail.maildlp.com (unknown [172.19.163.0]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4dy9TB1FXTz12LFD; Fri, 23 Jan 2026 16:05:02 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 65B0840537; Fri, 23 Jan 2026 16:08:59 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Fri, 23 Jan 2026 16:08:58 +0800 From: Jinjie Ruan To: , , , CC: Subject: [PATCH] kunit: time: use is_leap_year() helper Date: Fri, 23 Jan 2026 16:09:40 +0800 Message-ID: <20260123080940.335474-1-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Use the is_leap_year() helper from rtc.h instead of writing it by hand Signed-off-by: Jinjie Ruan --- kernel/time/time_test.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/kernel/time/time_test.c b/kernel/time/time_test.c index 2889763165e5..7c2fb5f775eb 100644 --- a/kernel/time/time_test.c +++ b/kernel/time/time_test.c @@ -2,14 +2,7 @@ =20 #include #include - -/* - * Traditional implementation of leap year evaluation. - */ -static bool is_leap(long year) -{ - return year % 4 =3D=3D 0 && (year % 100 !=3D 0 || year % 400 =3D=3D 0); -} +#include =20 /* * Gets the last day of a month. @@ -17,7 +10,7 @@ static bool is_leap(long year) static int last_day_of_month(long year, int month) { if (month =3D=3D 2) - return 28 + is_leap(year); + return 28 + is_leap_year(year); if (month =3D=3D 4 || month =3D=3D 6 || month =3D=3D 9 || month =3D=3D 11) return 30; return 31; --=20 2.34.1