* [PATCH v3] lib: math: tests: drop unnecessary KUnit param_value casts @ 2026-02-03 8:36 Titouan Ameline de Cadeville 2026-02-03 9:01 ` Kuan-Wei Chiu 0 siblings, 1 reply; 3+ messages in thread From: Titouan Ameline de Cadeville @ 2026-02-03 8:36 UTC (permalink / raw) To: linux-kernel Cc: linux-kselftest, kunit-dev, davidgow, raemoar63, kees, eleanor.lin, visitorckw, Titouan Ameline de Cadeville Drop unnecessary casts from KUnit parameter access since param_value is a void *. This improves readability and follows common kernel style. No functional change. Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline-de-cadeville@epita.fr> --- lib/math/tests/gcd_kunit.c | 2 +- lib/math/tests/int_log_kunit.c | 4 ++-- lib/math/tests/int_pow_kunit.c | 2 +- lib/math/tests/int_sqrt_kunit.c | 2 +- lib/math/tests/rational_kunit.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/math/tests/gcd_kunit.c b/lib/math/tests/gcd_kunit.c index ede1883583b1..b9c9b8758991 100644 --- a/lib/math/tests/gcd_kunit.c +++ b/lib/math/tests/gcd_kunit.c @@ -34,7 +34,7 @@ KUNIT_ARRAY_PARAM(gcd, params, get_desc); static void gcd_test(struct kunit *test) { - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; + const struct test_case_params *tc = test->param_value; KUNIT_EXPECT_EQ(test, tc->expected_result, gcd(tc->val1, tc->val2)); } diff --git a/lib/math/tests/int_log_kunit.c b/lib/math/tests/int_log_kunit.c index 14e854146cb4..9f9b48232701 100644 --- a/lib/math/tests/int_log_kunit.c +++ b/lib/math/tests/int_log_kunit.c @@ -43,7 +43,7 @@ KUNIT_ARRAY_PARAM(intlog2, intlog2_params, get_desc); static void intlog2_test(struct kunit *test) { - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; + const struct test_case_params *tc = test->param_value; KUNIT_EXPECT_EQ(test, tc->expected_result, intlog2(tc->value)); } @@ -52,7 +52,7 @@ KUNIT_ARRAY_PARAM(intlog10, intlog10_params, get_desc); static void intlog10_test(struct kunit *test) { - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; + const struct test_case_params *tc = test->param_value; KUNIT_EXPECT_EQ(test, tc->expected_result, intlog10(tc->value)); } diff --git a/lib/math/tests/int_pow_kunit.c b/lib/math/tests/int_pow_kunit.c index 34b33677d458..ef9c8a9bd8ac 100644 --- a/lib/math/tests/int_pow_kunit.c +++ b/lib/math/tests/int_pow_kunit.c @@ -31,7 +31,7 @@ KUNIT_ARRAY_PARAM(int_pow, params, get_desc); static void int_pow_test(struct kunit *test) { - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; + const struct test_case_params *tc = test->param_value; KUNIT_EXPECT_EQ(test, tc->expected_result, int_pow(tc->base, tc->exponent)); } diff --git a/lib/math/tests/int_sqrt_kunit.c b/lib/math/tests/int_sqrt_kunit.c index 1798e1312eb7..9c46024b0fc1 100644 --- a/lib/math/tests/int_sqrt_kunit.c +++ b/lib/math/tests/int_sqrt_kunit.c @@ -45,7 +45,7 @@ KUNIT_ARRAY_PARAM(int_sqrt, params, get_desc); static void int_sqrt_test(struct kunit *test) { - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; + const struct test_case_params *tc = test->param_value; KUNIT_EXPECT_EQ(test, tc->expected_result, int_sqrt(tc->x)); } diff --git a/lib/math/tests/rational_kunit.c b/lib/math/tests/rational_kunit.c index 47486a95f088..b05587a1e90a 100644 --- a/lib/math/tests/rational_kunit.c +++ b/lib/math/tests/rational_kunit.c @@ -33,7 +33,7 @@ KUNIT_ARRAY_PARAM(rational, test_parameters, get_desc); static void rational_test(struct kunit *test) { - const struct rational_test_param *param = (const struct rational_test_param *)test->param_value; + const struct rational_test_param *param = test->param_value; unsigned long n = 0, d = 0; rational_best_approximation(param->num, param->den, param->max_num, param->max_den, &n, &d); -- 2.44.2 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] lib: math: tests: drop unnecessary KUnit param_value casts 2026-02-03 8:36 [PATCH v3] lib: math: tests: drop unnecessary KUnit param_value casts Titouan Ameline de Cadeville @ 2026-02-03 9:01 ` Kuan-Wei Chiu [not found] ` <PAZP264MB276566C20A6B2AF39554339BE49BA@PAZP264MB2765.FRAP264.PROD.OUTLOOK.COM> 0 siblings, 1 reply; 3+ messages in thread From: Kuan-Wei Chiu @ 2026-02-03 9:01 UTC (permalink / raw) To: Titouan Ameline de Cadeville Cc: linux-kernel, linux-kselftest, kunit-dev, davidgow, raemoar63, kees, eleanor.lin, Titouan Ameline de Cadeville Hi Titouan, On Tue, Feb 03, 2026 at 09:36:08AM +0100, Titouan Ameline de Cadeville wrote: > Drop unnecessary casts from KUnit parameter access since param_value > is a void *. This improves readability and follows common kernel style. > > No functional change. > > Reviewed-by: David Gow <davidgow@google.com> > Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline-de-cadeville@epita.fr> checkpatch.pl reported the following warning: WARNING: From:/Signed-off-by: email address mismatch: 'From: Titouan Ameline de Cadeville <titouan.ameline@gmail.com>' != 'Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline-de-cadeville@epita.fr>' total: 0 errors, 1 warnings, 0 checks, 48 lines checked Regards, Kuan-Wei > --- > lib/math/tests/gcd_kunit.c | 2 +- > lib/math/tests/int_log_kunit.c | 4 ++-- > lib/math/tests/int_pow_kunit.c | 2 +- > lib/math/tests/int_sqrt_kunit.c | 2 +- > lib/math/tests/rational_kunit.c | 2 +- > 5 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/lib/math/tests/gcd_kunit.c b/lib/math/tests/gcd_kunit.c > index ede1883583b1..b9c9b8758991 100644 > --- a/lib/math/tests/gcd_kunit.c > +++ b/lib/math/tests/gcd_kunit.c > @@ -34,7 +34,7 @@ KUNIT_ARRAY_PARAM(gcd, params, get_desc); > > static void gcd_test(struct kunit *test) > { > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > + const struct test_case_params *tc = test->param_value; > > KUNIT_EXPECT_EQ(test, tc->expected_result, gcd(tc->val1, tc->val2)); > } > diff --git a/lib/math/tests/int_log_kunit.c b/lib/math/tests/int_log_kunit.c > index 14e854146cb4..9f9b48232701 100644 > --- a/lib/math/tests/int_log_kunit.c > +++ b/lib/math/tests/int_log_kunit.c > @@ -43,7 +43,7 @@ KUNIT_ARRAY_PARAM(intlog2, intlog2_params, get_desc); > > static void intlog2_test(struct kunit *test) > { > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > + const struct test_case_params *tc = test->param_value; > > KUNIT_EXPECT_EQ(test, tc->expected_result, intlog2(tc->value)); > } > @@ -52,7 +52,7 @@ KUNIT_ARRAY_PARAM(intlog10, intlog10_params, get_desc); > > static void intlog10_test(struct kunit *test) > { > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > + const struct test_case_params *tc = test->param_value; > > KUNIT_EXPECT_EQ(test, tc->expected_result, intlog10(tc->value)); > } > diff --git a/lib/math/tests/int_pow_kunit.c b/lib/math/tests/int_pow_kunit.c > index 34b33677d458..ef9c8a9bd8ac 100644 > --- a/lib/math/tests/int_pow_kunit.c > +++ b/lib/math/tests/int_pow_kunit.c > @@ -31,7 +31,7 @@ KUNIT_ARRAY_PARAM(int_pow, params, get_desc); > > static void int_pow_test(struct kunit *test) > { > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > + const struct test_case_params *tc = test->param_value; > > KUNIT_EXPECT_EQ(test, tc->expected_result, int_pow(tc->base, tc->exponent)); > } > diff --git a/lib/math/tests/int_sqrt_kunit.c b/lib/math/tests/int_sqrt_kunit.c > index 1798e1312eb7..9c46024b0fc1 100644 > --- a/lib/math/tests/int_sqrt_kunit.c > +++ b/lib/math/tests/int_sqrt_kunit.c > @@ -45,7 +45,7 @@ KUNIT_ARRAY_PARAM(int_sqrt, params, get_desc); > > static void int_sqrt_test(struct kunit *test) > { > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > + const struct test_case_params *tc = test->param_value; > > KUNIT_EXPECT_EQ(test, tc->expected_result, int_sqrt(tc->x)); > } > diff --git a/lib/math/tests/rational_kunit.c b/lib/math/tests/rational_kunit.c > index 47486a95f088..b05587a1e90a 100644 > --- a/lib/math/tests/rational_kunit.c > +++ b/lib/math/tests/rational_kunit.c > @@ -33,7 +33,7 @@ KUNIT_ARRAY_PARAM(rational, test_parameters, get_desc); > > static void rational_test(struct kunit *test) > { > - const struct rational_test_param *param = (const struct rational_test_param *)test->param_value; > + const struct rational_test_param *param = test->param_value; > unsigned long n = 0, d = 0; > > rational_best_approximation(param->num, param->den, param->max_num, param->max_den, &n, &d); > -- > 2.44.2 > ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <PAZP264MB276566C20A6B2AF39554339BE49BA@PAZP264MB2765.FRAP264.PROD.OUTLOOK.COM>]
* Re: [PATCH v3] lib: math: tests: drop unnecessary KUnit param_value casts [not found] ` <PAZP264MB276566C20A6B2AF39554339BE49BA@PAZP264MB2765.FRAP264.PROD.OUTLOOK.COM> @ 2026-02-03 14:49 ` Kuan-Wei Chiu 0 siblings, 0 replies; 3+ messages in thread From: Kuan-Wei Chiu @ 2026-02-03 14:49 UTC (permalink / raw) To: Titouan Ameline de cadeville Cc: Titouan Ameline de Cadeville, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, davidgow@google.com, raemoar63@gmail.com, kees@kernel.org, eleanor.lin@realtek.com Hi Titouan, On Tue, Feb 03, 2026 at 11:05:30AM +0000, Titouan Ameline de cadeville wrote: > Hi Kuan-Wei, > > Thanks for the warning, > I’ve resent this as v4 without email address mismatch. Please avoid top-posting. Also, please ensure the email is sent as strict plain text, without html or base64 encoding. Regards, Kuan-Wei > > Best regards, > Titouan > ________________________________ > De : Kuan-Wei Chiu <visitorckw@gmail.com> > Envoyé : mardi 3 février 2026 10:01 > À : Titouan Ameline de Cadeville <titouan.ameline@gmail.com> > Cc : linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>; linux-kselftest@vger.kernel.org <linux-kselftest@vger.kernel.org>; kunit-dev@googlegroups.com <kunit-dev@googlegroups.com>; davidgow@google.com <davidgow@google.com>; raemoar63@gmail.com <raemoar63@gmail.com>; kees@kernel.org <kees@kernel.org>; eleanor.lin@realtek.com <eleanor.lin@realtek.com>; Titouan Ameline de cadeville <titouan.ameline-de-cadeville@epita.fr> > Objet : Re: [PATCH v3] lib: math: tests: drop unnecessary KUnit param_value casts > > Hi Titouan, > > On Tue, Feb 03, 2026 at 09:36:08AM +0100, Titouan Ameline de Cadeville wrote: > > Drop unnecessary casts from KUnit parameter access since param_value > > is a void *. This improves readability and follows common kernel style. > > > > No functional change. > > > > Reviewed-by: David Gow <davidgow@google.com> > > Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline-de-cadeville@epita.fr> > > checkpatch.pl reported the following warning: > > WARNING: From:/Signed-off-by: email address mismatch: 'From: Titouan Ameline de Cadeville <titouan.ameline@gmail.com>' != 'Signed-off-by: Titouan Ameline de Cadeville <titouan.ameline-de-cadeville@epita.fr>' > > total: 0 errors, 1 warnings, 0 checks, 48 lines checked > > Regards, > Kuan-Wei > > > --- > > lib/math/tests/gcd_kunit.c | 2 +- > > lib/math/tests/int_log_kunit.c | 4 ++-- > > lib/math/tests/int_pow_kunit.c | 2 +- > > lib/math/tests/int_sqrt_kunit.c | 2 +- > > lib/math/tests/rational_kunit.c | 2 +- > > 5 files changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/lib/math/tests/gcd_kunit.c b/lib/math/tests/gcd_kunit.c > > index ede1883583b1..b9c9b8758991 100644 > > --- a/lib/math/tests/gcd_kunit.c > > +++ b/lib/math/tests/gcd_kunit.c > > @@ -34,7 +34,7 @@ KUNIT_ARRAY_PARAM(gcd, params, get_desc); > > > > static void gcd_test(struct kunit *test) > > { > > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > > + const struct test_case_params *tc = test->param_value; > > > > KUNIT_EXPECT_EQ(test, tc->expected_result, gcd(tc->val1, tc->val2)); > > } > > diff --git a/lib/math/tests/int_log_kunit.c b/lib/math/tests/int_log_kunit.c > > index 14e854146cb4..9f9b48232701 100644 > > --- a/lib/math/tests/int_log_kunit.c > > +++ b/lib/math/tests/int_log_kunit.c > > @@ -43,7 +43,7 @@ KUNIT_ARRAY_PARAM(intlog2, intlog2_params, get_desc); > > > > static void intlog2_test(struct kunit *test) > > { > > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > > + const struct test_case_params *tc = test->param_value; > > > > KUNIT_EXPECT_EQ(test, tc->expected_result, intlog2(tc->value)); > > } > > @@ -52,7 +52,7 @@ KUNIT_ARRAY_PARAM(intlog10, intlog10_params, get_desc); > > > > static void intlog10_test(struct kunit *test) > > { > > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > > + const struct test_case_params *tc = test->param_value; > > > > KUNIT_EXPECT_EQ(test, tc->expected_result, intlog10(tc->value)); > > } > > diff --git a/lib/math/tests/int_pow_kunit.c b/lib/math/tests/int_pow_kunit.c > > index 34b33677d458..ef9c8a9bd8ac 100644 > > --- a/lib/math/tests/int_pow_kunit.c > > +++ b/lib/math/tests/int_pow_kunit.c > > @@ -31,7 +31,7 @@ KUNIT_ARRAY_PARAM(int_pow, params, get_desc); > > > > static void int_pow_test(struct kunit *test) > > { > > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > > + const struct test_case_params *tc = test->param_value; > > > > KUNIT_EXPECT_EQ(test, tc->expected_result, int_pow(tc->base, tc->exponent)); > > } > > diff --git a/lib/math/tests/int_sqrt_kunit.c b/lib/math/tests/int_sqrt_kunit.c > > index 1798e1312eb7..9c46024b0fc1 100644 > > --- a/lib/math/tests/int_sqrt_kunit.c > > +++ b/lib/math/tests/int_sqrt_kunit.c > > @@ -45,7 +45,7 @@ KUNIT_ARRAY_PARAM(int_sqrt, params, get_desc); > > > > static void int_sqrt_test(struct kunit *test) > > { > > - const struct test_case_params *tc = (const struct test_case_params *)test->param_value; > > + const struct test_case_params *tc = test->param_value; > > > > KUNIT_EXPECT_EQ(test, tc->expected_result, int_sqrt(tc->x)); > > } > > diff --git a/lib/math/tests/rational_kunit.c b/lib/math/tests/rational_kunit.c > > index 47486a95f088..b05587a1e90a 100644 > > --- a/lib/math/tests/rational_kunit.c > > +++ b/lib/math/tests/rational_kunit.c > > @@ -33,7 +33,7 @@ KUNIT_ARRAY_PARAM(rational, test_parameters, get_desc); > > > > static void rational_test(struct kunit *test) > > { > > - const struct rational_test_param *param = (const struct rational_test_param *)test->param_value; > > + const struct rational_test_param *param = test->param_value; > > unsigned long n = 0, d = 0; > > > > rational_best_approximation(param->num, param->den, param->max_num, param->max_den, &n, &d); > > -- > > 2.44.2 > > ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-03 14:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03 8:36 [PATCH v3] lib: math: tests: drop unnecessary KUnit param_value casts Titouan Ameline de Cadeville
2026-02-03 9:01 ` Kuan-Wei Chiu
[not found] ` <PAZP264MB276566C20A6B2AF39554339BE49BA@PAZP264MB2765.FRAP264.PROD.OUTLOOK.COM>
2026-02-03 14:49 ` Kuan-Wei Chiu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox