Removes early_serial_console.c code if we don't have the config option that
enables it (EARLY_PRINTK). When disabling this code, make early_serial_base a
constant 0 to allow the compiler to optimize away the code that checks for
early_serial_base.

Signed-off-by: Joe Millenbach <jmillenb...@gmail.com>
Signed-off-by: Gokul Caushik <caush...@gmail.com>
Reviewed-by: Josh Triplett <j...@joshtriplett.org>
---
 arch/x86/boot/compressed/early_serial_console.c |    4 ++++
 arch/x86/boot/compressed/misc.h                 |   10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/x86/boot/compressed/early_serial_console.c 
b/arch/x86/boot/compressed/early_serial_console.c
index 261e81f..d3d003c 100644
--- a/arch/x86/boot/compressed/early_serial_console.c
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -1,5 +1,9 @@
 #include "misc.h"
 
+#ifdef CONFIG_EARLY_PRINTK
+
 int early_serial_base;
 
 #include "../early_serial_console.c"
+
+#endif
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
index 618e5c8..3ffee6e 100644
--- a/arch/x86/boot/compressed/misc.h
+++ b/arch/x86/boot/compressed/misc.h
@@ -43,7 +43,17 @@ int cmdline_find_option(const char *option, char *buffer, 
int bufsize);
 int cmdline_find_option_bool(const char *option);
 
 /* early_serial_console.c */
+#ifdef CONFIG_EARLY_PRINTK
+
 extern int early_serial_base;
 void console_init(void);
 
+#else
+
+static const int early_serial_base;
+static inline void console_init(void)
+{ }
+
+#endif
+
 #endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to