aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2011-07-20 11:38:57 -0400
committerMichal Marek <mmarek@suse.cz>2011-07-29 15:53:30 -0400
commit2a11c8ea20bf850b3a2c60db8c2e7497d28aba99 (patch)
tree975a44ccb84f5fb182fa1d6d58025b0cde381965 /include
parentbac6aa865b3dc98e9fbc17f11d4d513d6b0bc435 (diff)
kconfig: Introduce IS_ENABLED(), IS_BUILTIN() and IS_MODULE()
Replace the config_is_*() macros with a variant that allows for grepping for usage of CONFIG_* options in the code. Usage: if (IS_ENABLED(CONFIG_NUMA)) or #if IS_ENABLED(CONFIG_NUMA) The IS_ENABLED() macro evaluates to 1 if the argument is set (to either 'y' or 'm'), IS_BUILTIN() tests if the option is 'y' and IS_MODULE() test if the option is 'm'. Only boolean and tristate options are supported. Reviewed-by: Arnaud Lacombe <lacombar@gmail.com> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kconfig.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h
new file mode 100644
index 000000000000..067eda0e4b32
--- /dev/null
+++ b/include/linux/kconfig.h
@@ -0,0 +1,32 @@
1#ifndef __LINUX_KCONFIG_H
2#define __LINUX_KCONFIG_H
3
4#include <generated/autoconf.h>
5
6/*
7 * Helper macros to use CONFIG_ options in C expressions. Note that
8 * these only work with boolean and tristate options.
9 */
10
11/*
12 * IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',
13 * 0 otherwise.
14 *
15 */
16#define IS_ENABLED(option) \
17 (__enabled_ ## option || __enabled_ ## option ## _MODULE)
18
19/*
20 * IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0
21 * otherwise. For boolean options, this is equivalent to
22 * IS_ENABLED(CONFIG_FOO).
23 */
24#define IS_BUILTIN(option) __enabled_ ## option
25
26/*
27 * IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0
28 * otherwise.
29 */
30#define IS_MODULE(option) __enabled_ ## option ## _MODULE
31
32#endif /* __LINUX_KCONFIG_H */