math: RATIONAL and RATIONAL_KUNIT_TEST improvements
Subsystems (2)
cover math: RATIONAL and RATIONAL_KUNIT_TEST improvements
Hi all,
This patch series makes the RATIONAL symbol tristate, so it is not forced builtin if all users are modular, and makes the RATIONAL_KUNIT_TEST depend on RATIONAL, to avoid enabling RATIONAL if there are no real users.
Changes compared to v1:
- Drop compile-testing and help text for RATIONAL.
- Make RATIONAL_KUNIT_TEST depend on RATIONAL.
Thanks for your comments!
[1] https://lore.kernel.org/r/[email protected]/
Geert Uytterhoeven (2):
math: Make RATIONAL tristate
math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of
selecting it
lib/Kconfig.debug | 3 +-- lib/math/Kconfig | 2 +- lib/math/rational.c | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-)
Signature · 12 lines
2.25.1
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus TorvaldsPATCH 1/2 math: Make RATIONAL tristate
All but one symbols that select RATIONAL are tristate, but RATIONAL itself is bool. Change it to tristate, so the rational fractions support code can be modular if no builtin code relies on it.
---
Exposed by commit b6c75c4afceb8bc0 ("lib/math/rational: add Kunit test cases") and CONFIG_KUNIT_ALL_TESTS=m.
v2:
- Drop compile-testing and help text.
--- lib/math/Kconfig | 2 +- lib/math/rational.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)
lib/math/Kconfig +1 -1
@@ -14,4 +14,4 @@ config PRIME_NUMBERS If unsure, say N. config RATIONAL - bool + tristate
lib/math/rational.c +3 -0
@@ -13,6 +13,7 @@#include <linux/export.h> #include <linux/minmax.h> #include <linux/limits.h> +#include <linux/module.h> /* * calculate best rational approximation for a given fraction
@@ -106,3 +107,5 @@ void rational_best_approximation( }EXPORT_SYMBOL (rational_best_approximation); + +MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.25.1
Re: [PATCH 1/2] math: Make RATIONAL tristate
Quoted 3 lines · Geert Uytterhoeven
All but one symbols that select RATIONAL are tristate, but RATIONAL itself is bool. Change it to tristate, so the rational fractions support code can be modular if no builtin code relies on it.
Works for me,
Quoted 43 lines
Signed-off-by Geert Uytterhoeven <[email protected]>---
Exposed by commitb6c75c4afceb8bc0("lib/math/rational: add Kunit test cases") andCONFIG_KUNIT_ALL_TESTS=m.v2:
- Drop compile-testing and help text.--- lib/math/Kconfig | 2 +- lib/math/rational.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-)lib/math/Kconfig +1
-1@@ -14,4 +14,4 @@ config PRIME_NUMBERS If unsure, say N. config RATIONAL - bool + tristatelib/math/rational.c +3
-0@@ -13,6 +13,7 @@#include <linux/export.h> #include <linux/minmax.h> #include <linux/limits.h> +#include <linux/module.h> /* * calculate best rational approximation for a given fraction @@ -106,3 +107,5 @@ void rational_best_approximation( }EXPORT_SYMBOL (rational_best_approximation); + +MODULE_LICENSE ("GPL v2" );Signature · 1 line
2.25.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 2/2 math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of selecting it
In reply to Geert UytterhoevenRATIONAL_KUNIT_TEST selects RATIONAL, thus enabling an optional feature the user may not want to have enabled. Fix this by making the test depend on RATIONAL instead.
---
The RATIONAL config symbol is not visible, which means that this test can only be enabled when there is a user of RATIONAL.
v2:
- New.
--- lib/Kconfig.debug | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/Kconfig.debug +1 -2
@@ -2449,8 +2449,7 @@ config SLUB_KUNIT_TEST config RATIONAL_KUNIT_TEST tristate "KUnit test for rational.c" if !KUNIT_ALL_TESTS - depends on KUNIT - select RATIONAL + depends on KUNIT && RATIONAL default KUNIT_ALL_TESTS help This builds the rational math unit test.
Signature · 1 line
2.25.1