diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2021-05-05 20:45:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 18:39:42 +0300 |
commit | 44a2a912c75049fa6cb2306ec8bc1276544b0c62 (patch) | |
tree | 1c26d453d7337495b99d767dc3e5edf8e7829fdb /include | |
parent | 9a6dca86cfae3cefe857633d6670a5c9a64e31c3 (diff) | |
download | linux-44a2a912c75049fa6cb2306ec8bc1276544b0c62.tar.xz |
linux/kconfig.h: replace IF_ENABLED() with PTR_IF() in <linux/kernel.h>
[ Upstream commit 0ab1438bad43d95877f848b7df551bd431680270 ]
<linux/kconfig.h> is included from all the kernel-space source files,
including C, assembly, linker scripts. It is intended to contain a
minimal set of macros to evaluate CONFIG options.
IF_ENABLED() is an intruder here because (x ? y : z) is C code, which
should not be included from assembly files or linker scripts.
Also, <linux/kconfig.h> is no longer self-contained because NULL is
defined in <linux/stddef.h>.
Move IF_ENABLED() out to <linux/kernel.h> as PTR_IF(). PTF_IF()
takes the general boolean expression instead of a CONFIG option
so that it fits better in <linux/kernel.h>.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Stable-dep-of: 18ab69c8ca56 ("Input: iqs269a - do not poll during suspend or resume")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kernel.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 394f10fc29aa..66948e1bf4fa 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -47,6 +47,8 @@ */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#define PTR_IF(cond, ptr) ((cond) ? (ptr) : NULL) + #define u64_to_user_ptr(x) ( \ { \ typecheck(u64, (x)); \ |