[PATCH 17/17] kconfig: Add a new CONFIG() macro
Simon Glass
sjg at chromium.org
Fri Sep 17 18:17:40 CEST 2021
It is annoying to have to use IS_ENABLED() and CONFIG_IS_ENABLED(),
depending on whether the option being checked has an SPL version. Also
we use #ifdef CONFIG_xxx and #if defined(CONFIG_xxx) in some contexts.
It would be nice to use a single style consistenty.
Add a CONFIG() macro to this end, to check configuration. The argument is
the Kconfig name to check, excluding any SPL_/TPL_ prefix, for example:
CONFIG(DM)
CONFIG(CMD_MISC)
CONFIG(OF_PLATDATA)
This is just for illustration, but it should be possible to drop
IS_ENABLED() and CONFIG_IS_ENABLED(), once migration of ad-hoc CONFIG
is complete. The use of #ifdef and defined() can be updated also.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
include/linux/kconfig.h | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index e6b0f238ec4..401341275fe 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -28,14 +28,6 @@
#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
#define ___config_enabled(__ignored, val, ...) val
-/*
- * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y',
- * 0 otherwise.
- *
- */
-#define IS_ENABLED(option) \
- (config_enabled(option))
-
/*
* The _nospl version of a CONFIG is emitted by kconfig when an option has no
* SPL equivalent. So in that case there is a CONFIG_xxx for example, but not a
@@ -51,11 +43,11 @@
config_enabled(CONFIG_ ## cfg))
/*
- * CONFIG_IS_ENABLED(FOO) returns 1 if CONFIG_FOO is enabled for the phase being
+ * CONFIG(FOO) returns 1 if CONFIG_FOO is enabled for the phase being
* built, else 0. Note that CONFIG_FOO corresponds to CONFIG_SPL_FOO (in
* Kconfig) for the SPL phase, CONFIG_TPL_FOO for the TPL phase, etc.
*/
-#define CONFIG_IS_ENABLED(option) __config_is_enabled(option)
+#define CONFIG(option) __config_is_enabled(option)
#define __config_val(cfg) CONFIG_ ## cfg
--
2.33.0.309.g3052b89438-goog
More information about the U-Boot
mailing list