kconfig: add a function to get the CONFIG_ prefix
authorYann E. MORIN <yann.morin.1998@free.fr>
Fri, 19 Oct 2012 23:06:24 +0000 (01:06 +0200)
committerChristian Lamparter <chunkeey@googlemail.com>
Fri, 22 Mar 2013 23:23:03 +0000 (00:23 +0100)
Currently, we get the CONFIG_ prefix via the CONFIG_ macro, which means
the CONFIG_ prefix is hard-coded at compile time. This goes against
having a run-time defined CONFIG_ prefix.

Add a function that returns the CONFIG_ prefix to use (but keep the
current hard-coded behavior, to be changed in a later patch).

To avoid touching all the code that uses the CONFIG_ macro, we just
undef it, and define it to be a call to the function.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
config/lkc.h

index c18f2bd9c095510d1d5e58575b265bd67ae9e781..7aa9db0b2a7776513bfb7ad7f9a79d567509861a 100644 (file)
@@ -39,6 +39,12 @@ extern "C" {
 #ifndef CONFIG_
 #define CONFIG_ "CONFIG_"
 #endif
 #ifndef CONFIG_
 #define CONFIG_ "CONFIG_"
 #endif
+static inline const char *CONFIG_prefix(void)
+{
+       return CONFIG_;
+}
+#undef CONFIG_
+#define CONFIG_ CONFIG_prefix()
 
 #define TF_COMMAND     0x0001
 #define TF_PARAM       0x0002
 
 #define TF_COMMAND     0x0001
 #define TF_PARAM       0x0002