1#ifndef __LINUX_KCONFIG_H
2#define __LINUX_KCONFIG_H
3
4#include <generated/autoconf.h>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19#define __ARG_PLACEHOLDER_1 0,
20#define config_enabled(cfg) _config_enabled(cfg)
21#define _config_enabled(value) __config_enabled(__ARG_PLACEHOLDER_##value)
22#define __config_enabled(arg1_or_junk) ___config_enabled(arg1_or_junk 1, 0)
23#define ___config_enabled(__ignored, val, ...) val
24
25
26
27
28
29
30#define IS_ENABLED(option) \
31 (config_enabled(option) || config_enabled(option##_MODULE))
32
33
34
35
36
37
38#define IS_BUILTIN(option) config_enabled(option)
39
40
41
42
43
44#define IS_MODULE(option) config_enabled(option##_MODULE)
45
46
47
48
49
50#ifdef CONFIG_SPL_BUILD
51#define _IS_SPL 1
52#endif
53
54#ifdef CONFIG_TPL_BUILD
55#define _IS_TPL 1
56#endif
57
58#if defined(CONFIG_TPL_BUILD)
59#define config_val(cfg) _config_val(_IS_TPL, cfg)
60#define _config_val(x, cfg) __config_val(x, cfg)
61#define __config_val(x, cfg) ___config_val(__ARG_PLACEHOLDER_##x, cfg)
62#define ___config_val(arg1_or_junk, cfg) \
63 ____config_val(arg1_or_junk CONFIG_TPL_##cfg, CONFIG_##cfg)
64#define ____config_val(__ignored, val, ...) val
65#else
66#define config_val(cfg) _config_val(_IS_SPL, cfg)
67#define _config_val(x, cfg) __config_val(x, cfg)
68#define __config_val(x, cfg) ___config_val(__ARG_PLACEHOLDER_##x, cfg)
69#define ___config_val(arg1_or_junk, cfg) \
70 ____config_val(arg1_or_junk CONFIG_SPL_##cfg, CONFIG_##cfg)
71#define ____config_val(__ignored, val, ...) val
72#endif
73
74
75
76
77
78
79
80#define CONFIG_VAL(option) config_val(option)
81
82
83
84
85
86
87
88
89#define CONFIG_IS_ENABLED(option) \
90 (config_enabled(CONFIG_VAL(option)) || \
91 config_enabled(CONFIG_VAL(option##_MODULE)))
92
93
94
95
96
97
98
99#define CONFIG_IS_BUILTIN(option) config_enabled(CONFIG_VAL(option))
100
101
102
103
104
105
106
107#define CONFIG_IS_MODULE(option) config_enabled(CONFIG_VAL(option##_MODULE))
108
109#endif
110