From 3c75a7c47e5f97ab3fdc878db8a00fbb92e8659e Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 2 Apr 2019 04:15:18 +0000 Subject: [PATCH] scst/include/backport.h: Add an IS_ENABLED() backport git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8137 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/backport.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/scst/include/backport.h b/scst/include/backport.h index 576d7d65b..caeaec206 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -532,6 +532,25 @@ static inline struct io_context *get_task_io_context(struct task_struct *task, } #endif +/* */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 1, 0) && !defined(RHEL_MAJOR) +/* + * See also commit 2a11c8ea20bf ("kconfig: Introduce IS_ENABLED(), IS_BUILTIN() + * and IS_MODULE()") # v3.1. + */ +#define __ARG_PLACEHOLDER_1 0, +#define __take_second_arg(__ignored, val, ...) val +#define __or(x, y) ___or(x, y) +#define ___or(x, y) ____or(__ARG_PLACEHOLDER_##x, y) +#define ____or(arg1_or_junk, y) __take_second_arg(arg1_or_junk 1, y) +#define __is_defined(x) ___is_defined(x) +#define ___is_defined(val) ____is_defined(__ARG_PLACEHOLDER_##val) +#define ____is_defined(arg1_or_junk) __take_second_arg(arg1_or_junk 1, 0) +#define IS_BUILTIN(option) __is_defined(option) +#define IS_MODULE(option) __is_defined(option##_MODULE) +#define IS_ENABLED(option) __or(IS_BUILTIN(option), IS_MODULE(option)) +#endif + /* */ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)