lib: math: tests: drop unnecessary KUnit param_value casts
PATCH v5 1/1 lib: math: tests: drop unnecessary KUnit param_value casts
Drop unnecessary casts from KUnit parameter access since param_value is a void *. This improves readability and follows common kernel style.
No functional change.
---
Changes in v5:
- Use consistent email address in From/Author/Signed-off-by ([email protected]).
- Add version changelog below the '---' line.
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(-)
lib/math/tests/gcd_kunit.c +1 -1
@@ -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)); }
lib/math/tests/int_log_kunit.c +2 -2
@@ -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)); }
lib/math/tests/int_pow_kunit.c +1 -1
@@ -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)); }
lib/math/tests/int_sqrt_kunit.c +1 -1
@@ -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)); }
lib/math/tests/rational_kunit.c +1 -1
@@ -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);
Signature · 1 line
2.44.2
Quoted 2 lines · Titouan Ameline de Cadeville
Drop unnecessary casts from KUnit parameter access since
param_valueis a void *. This improves readability and follows common kernel style.
I'm not necessarily against this patch, but to be honest, I don't see how this "improves readability."
Regards,
Kuan-Wei
Quoted 95 lines
No functional change.
Reviewed-by David Gow <[email protected]>Signed-off-by Titouan Ameline de Cadeville <[email protected]>---
Changes in v5:
- Use consistent email address in From/Author/Signed-off-by ([email protected]).
- Add version changelog below the '---' line.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(-)lib/math/tests/gcd_kunit.c +1
-1@@ -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)); }lib/math/tests/int_log_kunit.c +2
-2@@ -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)); }lib/math/tests/int_pow_kunit.c +1
-1@@ -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)); }lib/math/tests/int_sqrt_kunit.c +1
-1@@ -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)); }lib/math/tests/rational_kunit.c +1
-1@@ -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);Signature · 1 line
2.44.2