forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]> Acked-by: Randy Dunlap <[email protected]> Signed-off-by: Michal Marek <[email protected]>
- Loading branch information
Showing
3 changed files
with
47 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#ifndef __LINUX_KCONFIG_H | ||
#define __LINUX_KCONFIG_H | ||
|
||
#include <generated/autoconf.h> | ||
|
||
/* | ||
* Helper macros to use CONFIG_ options in C expressions. Note that | ||
* these only work with boolean and tristate options. | ||
*/ | ||
|
||
/* | ||
* IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm', | ||
* 0 otherwise. | ||
* | ||
*/ | ||
#define IS_ENABLED(option) \ | ||
(__enabled_ ## option || __enabled_ ## option ## _MODULE) | ||
|
||
/* | ||
* IS_BUILTIN(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y', 0 | ||
* otherwise. For boolean options, this is equivalent to | ||
* IS_ENABLED(CONFIG_FOO). | ||
*/ | ||
#define IS_BUILTIN(option) __enabled_ ## option | ||
|
||
/* | ||
* IS_MODULE(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'm', 0 | ||
* otherwise. | ||
*/ | ||
#define IS_MODULE(option) __enabled_ ## option ## _MODULE | ||
|
||
#endif /* __LINUX_KCONFIG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters