aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2022-01-22 05:07:25 -0700
committerTom Rini2022-02-08 23:07:59 -0500
commit310bfa737f2cdf6bdcab7637b220a061d2807e99 (patch)
treea308f4e3a98075dbd003aebc91a9a49f106cd3db
parent93cb515fe307453ccf8250cf56b3cc1a3dc06a6f (diff)
kconfig: Update IS_ENABLED() internals
The config_enabled() macro currently uses 0 as the default value. Update it to allow any value, so we can pass it something else, such as a non-existent function, to produce a build error if it is not defined. Also tidy up the code style for IS_ENABLED() and drop the unnecessary brackets (the value is a simple 0 or 1). Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--include/linux/kconfig.h12
1 files changed, 5 insertions, 7 deletions
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
index a1d1a298426..52586a7557b 100644
--- a/include/linux/kconfig.h
+++ b/include/linux/kconfig.h
@@ -17,18 +17,16 @@
* the last step cherry picks the 2nd arg, we get a zero.
*/
#define __ARG_PLACEHOLDER_1 0,
-#define config_enabled(cfg) _config_enabled(cfg)
-#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
-#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
+#define config_enabled(cfg, def_val) _config_enabled(cfg, def_val)
+#define _config_enabled(value, def_val) __config_enabled(__ARG_PLACEHOLDER_##value, def_val)
+#define __config_enabled(arg1_or_junk, def_val) ___config_enabled(arg1_or_junk 1, def_val)
#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))
+#define IS_ENABLED(option) config_enabled(option, 0)
/*
* U-Boot add-on: Helper macros to reference to different macros (prefixed by
@@ -76,7 +74,7 @@
#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) \
- __concat(__unwrap, config_enabled(CONFIG_VAL(option))) (case1, case0)
+ __concat(__unwrap, config_enabled(CONFIG_VAL(option), 0)) (case1, case0)
/*
* CONFIG_IS_ENABLED(FOO) expands to