All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] math: RATIONAL and RATIONAL_KUNIT_TEST improvements
@ 2021-07-06 10:09 Geert Uytterhoeven
  2021-07-06 10:09 ` [PATCH 1/2] math: Make RATIONAL tristate Geert Uytterhoeven
  2021-07-06 10:09 ` [PATCH 2/2] math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of selecting it Geert Uytterhoeven
  0 siblings, 2 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-07-06 10:09 UTC (permalink / raw)
  To: Trent Piepho, Colin Ian King, Andy Shevchenko, Andrew Morton,
	Brendan Higgins
  Cc: linux-kselftest, kunit-dev, linux-kernel, Geert Uytterhoeven

	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(-)

-- 
2.25.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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 Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] math: Make RATIONAL tristate
  2021-07-06 10:09 [PATCH 0/2] math: RATIONAL and RATIONAL_KUNIT_TEST improvements Geert Uytterhoeven
@ 2021-07-06 10:09 ` Geert Uytterhoeven
  2021-07-06 10:31   ` Andy Shevchenko
  2021-07-06 10:09 ` [PATCH 2/2] math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of selecting it Geert Uytterhoeven
  1 sibling, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-07-06 10:09 UTC (permalink / raw)
  To: Trent Piepho, Colin Ian King, Andy Shevchenko, Andrew Morton,
	Brendan Higgins
  Cc: linux-kselftest, kunit-dev, linux-kernel, 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.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of selecting it
  2021-07-06 10:09 [PATCH 0/2] math: RATIONAL and RATIONAL_KUNIT_TEST improvements Geert Uytterhoeven
  2021-07-06 10:09 ` [PATCH 1/2] math: Make RATIONAL tristate Geert Uytterhoeven
@ 2021-07-06 10:09 ` Geert Uytterhoeven
  1 sibling, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2021-07-06 10:09 UTC (permalink / raw)
  To: Trent Piepho, Colin Ian King, Andy Shevchenko, Andrew Morton,
	Brendan Higgins
  Cc: linux-kselftest, kunit-dev, linux-kernel, Geert Uytterhoeven

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.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] math: Make RATIONAL tristate
  2021-07-06 10:09 ` [PATCH 1/2] math: Make RATIONAL tristate Geert Uytterhoeven
@ 2021-07-06 10:31   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-07-06 10:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Trent Piepho, Colin Ian King, Andrew Morton, Brendan Higgins,
	linux-kselftest, kunit-dev, linux-kernel

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
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-07-06 10:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 10:09 [PATCH 0/2] math: RATIONAL and RATIONAL_KUNIT_TEST improvements Geert Uytterhoeven
2021-07-06 10:09 ` [PATCH 1/2] math: Make RATIONAL tristate Geert Uytterhoeven
2021-07-06 10:31   ` Andy Shevchenko
2021-07-06 10:09 ` [PATCH 2/2] math: RATIONAL_KUNIT_TEST should depend on RATIONAL instead of selecting it Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.