rtc: Improve performance of rtc_time64_to_tm. Add tests.
PATCH v2 1/1 rtc: Improve performance of rtc_time64_to_tm. Add tests.
Signed-off-by Cassio Neri <[email protected]>
Reported-by kernel test robot <[email protected]>
---
Fix link issue on 32 bit platforms raised from the v1.
--- drivers/rtc/lib_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rtc/lib_test.c +4 -1
@@ -45,13 +45,16 @@ static void rtc_time64_to_tm_test_date_range(struct kunit *test)struct rtc_time result;time64_t secs; +s64 days;for (secs =0 ; secs <= total_secs; secs +=86400 ) {rtc_time64_to_tm (secs, &result); + days =div_s64 (secs,86400 ); +#define FAIL_MSG "%d/%02d/%02d (%2d) : %ld", \ - year, month, mday, yday, secs/86400 + year, month, mday, yday, daysKUNIT_ASSERT_EQ_MSG (test, year -1900 , result.tm_year,FAIL_MSG );KUNIT_ASSERT_EQ_MSG (test, month -1 , result.tm_mon,FAIL_MSG );
base-commit: bcae59d0d45b866d5b9525ea8ece6d671e6767c8
prerequisite-patch-id: ea804a9b3d52cd4f6bfbbf1c53260cb8f2d2c60b
Signature · 1 line
2.31.0
Alexandre Belloni
maintainerHello,
Your v2 as to be self contained, not a simple patch on top of v1.
Quoted 39 lines · Cassio Neri
Signed-off-by Cassio Neri <[email protected]>Reported-by kernel test robot <[email protected]>---
Fix link issue on 32 bit platforms raised from the v1.
--- drivers/rtc/lib_test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/rtc/lib_test.c +4
-1@@ -45,13 +45,16 @@ static void rtc_time64_to_tm_test_date_range(struct kunit *test)struct rtc_time result;time64_t secs; +s64 days;for (secs =0 ; secs <= total_secs; secs +=86400 ) {rtc_time64_to_tm (secs, &result); + days =div_s64 (secs,86400 ); +#define FAIL_MSG "%d/%02d/%02d (%2d) : %ld", \ - year, month, mday, yday, secs/86400 + year, month, mday, yday, daysKUNIT_ASSERT_EQ_MSG (test, year -1900 , result.tm_year,FAIL_MSG );KUNIT_ASSERT_EQ_MSG (test, month -1 , result.tm_mon,FAIL_MSG );base-commit:
bcae59d0d45b866d5b9525ea8ece6d671e6767c8
prerequisite-patch-id:ea804a9b3d52cd4f6bfbbf1c53260cb8f2d2c60bSignature · 1 line
2.31.0
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com