[PATCH v3 74/81] kconfig: Drop CONFIG_IS_ENABLED()
Simon Glass
sjg at chromium.org
Mon Feb 6 20:05:42 CET 2023
We can use IS_ENABLED() now, so drop the CONFIG_IS_ENABLED() macro.
Also drop a comment that mentions it.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v3:
- Drop a comment which mentions CONFIG_IS_ENABLED()
drivers/serial/ns16550.c | 1 -
include/linux/kconfig.h | 23 ++++++++---------------
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index ab96cebd4ea..1d384ddbe12 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -610,7 +610,6 @@ static const struct udevice_id ns16550_serial_ids[] = {
#if IS_ENABLED(CONFIG_SERIAL_PRESENT)
-/* TODO(sjg at chromium.org): Integrate this into a macro like CONFIG_IS_ENABLED */
#if !defined(CONFIG_TPL_BUILD) || defined(CONFIG_TPL_DM_SERIAL)
U_BOOT_DRIVER(ns16550_serial) = {
.name = "ns16550_serial",
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index 77d8e6b6129..a2c8e58cb4d 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -61,32 +61,25 @@
#define __unwrap1(case1, case0) __unwrap case1
#define __unwrap0(case1, case0) __unwrap case0
-#define __CONFIG_IS_ENABLED_1(option) __CONFIG_IS_ENABLED_3(option, (1), (0))
-#define __CONFIG_IS_ENABLED_2(option, case1) __CONFIG_IS_ENABLED_3(option, case1, ())
-#define __CONFIG_IS_ENABLED_3(option, case1, case0) \
+#define __IS_ENABLED_1(option) __IS_ENABLED_3(option, (1), (0))
+#define __IS_ENABLED_2(option, case1) __IS_ENABLED_3(option, case1, ())
+#define __IS_ENABLED_3(option, case1, case0) \
__concat(__unwrap, config_enabled(option, 0)) (case1, case0)
/*
- * CONFIG_IS_ENABLED(CONFIG_FOO) returns 1 if CONFIG_FOO is enabled for the
- * phase being built, else 0.
+ * IS_ENABLED(CONFIG_FOO) returns 1 if CONFIG_FOO is enabled for the phase being
+ * built, else 0.
*
* The optional second and third arguments must be parenthesized; that
* allows one to include a trailing comma, e.g. for use in
*
- * CONFIG_IS_ENABLED(CONFIG_ACME, ({.compatible = "acme,frobnozzle"},))
+ * IS_ENABLED(CONFIG_ACME, ({.compatible = "acme,frobnozzle"},))
*
* which adds an entry to the array being defined if CONFIG_ACME is
* set, and nothing otherwise.
*/
-
-#define CONFIG_IS_ENABLED(option, ...) \
- __concat(__CONFIG_IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__)
-
-/*
- * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y',
- * 0 otherwise.
- */
-#define IS_ENABLED(option, ...) CONFIG_IS_ENABLED(option, ##__VA_ARGS__)
+#define IS_ENABLED(option, ...) \
+ __concat(__IS_ENABLED_, __count_args(option, ##__VA_ARGS__)) (option, ##__VA_ARGS__)
#ifndef __ASSEMBLY__
/*
--
2.39.1.519.gcb327c4b5f-goog
More information about the U-Boot
mailing list