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/20210705114633.1500710-1-geert@linux-m68k.org/
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(-)
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.
Signed-off-by: Geert Uytterhoeven geert@linux-m68k.org --- 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(-)
diff --git a/lib/math/Kconfig b/lib/math/Kconfig index f19bc9734fa7cc4b..0634b428d0cb7f86 100644 --- a/lib/math/Kconfig +++ b/lib/math/Kconfig @@ -14,4 +14,4 @@ config PRIME_NUMBERS If unsure, say N.
config RATIONAL - bool + tristate diff --git a/lib/math/rational.c b/lib/math/rational.c index c0ab51d8fbb98d17..ec59d426ea638b0f 100644 --- a/lib/math/rational.c +++ b/lib/math/rational.c @@ -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");
On Tue, Jul 06, 2021 at 12:09:44PM +0200, Geert Uytterhoeven wrote:
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, Reviewed-by: Andy Shevchenko andriy.shevchenko@linux.intel.com
Signed-off-by: Geert Uytterhoeven geert@linux-m68k.org
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(-)
diff --git a/lib/math/Kconfig b/lib/math/Kconfig index f19bc9734fa7cc4b..0634b428d0cb7f86 100644 --- a/lib/math/Kconfig +++ b/lib/math/Kconfig @@ -14,4 +14,4 @@ config PRIME_NUMBERS If unsure, say N. config RATIONAL
- bool
- tristate
diff --git a/lib/math/rational.c b/lib/math/rational.c index c0ab51d8fbb98d17..ec59d426ea638b0f 100644 --- a/lib/math/rational.c +++ b/lib/math/rational.c @@ -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");
2.25.1
RATIONAL_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.
Fixes: b6c75c4afceb8bc0 ("lib/math/rational: add Kunit test cases") Signed-off-by: Geert Uytterhoeven geert@linux-m68k.org --- 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(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 8acc01d7d816518c..f368764ff4a91f4a 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -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.
linux-kselftest-mirror@lists.linaro.org