Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101AbbDFLDM (ORCPT ); Mon, 6 Apr 2015 07:03:12 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:34163 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751141AbbDFLDH (ORCPT ); Mon, 6 Apr 2015 07:03:07 -0400 From: Alexander Kuleshov To: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" Cc: linux-kernel@vger.kernel.org, Alexander Kuleshov Subject: [PATCH RFC] x86/boot, earlyprintk: do not compile early_setup_console if !CONFIG_EARLY_PRINTK Date: Mon, 6 Apr 2015 17:02:53 +0600 Message-Id: <1428318173-32607-1-git-send-email-kuleshovmail@gmail.com> X-Mailer: git-send-email 2.3.3.611.g09038fc.dirty Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3649 Lines: 111 There is the call of the console_init() function in the arch/x86/boot/main.c which tries to find 'earlyprintk' option in the kernel command line. This function called every time regardless of the CONFIG_EARLY_PRINTK, but we no need in it if CONFIG_EARLY_PRINTK is not set. Signed-off-by: Alexander Kuleshov --- arch/x86/boot/Makefile | 6 +++--- arch/x86/boot/boot.h | 6 ++++++ arch/x86/boot/early_serial_console.c | 2 ++ arch/x86/boot/tty.c | 6 ++++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile index 57bbf2f..e21ebc8 100644 --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -23,10 +23,10 @@ targets += fdimage fdimage144 fdimage288 image.iso mtools.conf subdir- := compressed setup-y += a20.o bioscall.o cmdline.o copy.o cpu.o cpuflags.o cpucheck.o -setup-y += early_serial_console.o edd.o header.o main.o mca.o memory.o -setup-y += pm.o pmjump.o printf.o regs.o string.o tty.o video.o -setup-y += video-mode.o version.o +setup-y += edd.o header.o main.o mca.o memory.o pm.o pmjump.o printf.o +setup-y += regs.o string.o tty.o video.o video-mode.o version.o setup-$(CONFIG_X86_APM_BOOT) += apm.o +setup-$(CONFIG_EARLY_PRINTK) += early_serial_console.o # The link order of the video-*.o modules can matter. In particular, # video-vga.o *must* be listed first, followed by video-vesa.o. diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h index bd49ec6..5c353d2 100644 --- a/arch/x86/boot/boot.h +++ b/arch/x86/boot/boot.h @@ -297,9 +297,15 @@ static inline int cmdline_find_option_bool(const char *option) int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr); int validate_cpu(void); +#ifdef CONFIG_EARLY_PRINTK /* early_serial_console.c */ extern int early_serial_base; void console_init(void); +#else +static const int early_serial_base; +static inline void console_init(void) +{ } +#endif /* edd.c */ void query_edd(void); diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c index 45a0768..5c8e9f8 100644 --- a/arch/x86/boot/early_serial_console.c +++ b/arch/x86/boot/early_serial_console.c @@ -1,5 +1,7 @@ #include "boot.h" +int early_serial_base; + #define DEFAULT_SERIAL_PORT 0x3f8 /* ttyS0 */ #define DLAB 0x80 diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c index def2451..b5bd9d7 100644 --- a/arch/x86/boot/tty.c +++ b/arch/x86/boot/tty.c @@ -15,8 +15,6 @@ #include "boot.h" -int early_serial_base; - #define XMTRDY 0x20 #define TXR 0 /* Transmit register (WRITE) */ @@ -27,6 +25,7 @@ int early_serial_base; * error during initialization. */ +#ifdef CONFIG_EARLY_PRINTK static void __attribute__((section(".inittext"))) serial_putchar(int ch) { unsigned timeout = 0xffff; @@ -36,6 +35,7 @@ static void __attribute__((section(".inittext"))) serial_putchar(int ch) outb(ch, early_serial_base + TXR); } +#endif static void __attribute__((section(".inittext"))) bios_putchar(int ch) { @@ -56,8 +56,10 @@ void __attribute__((section(".inittext"))) putchar(int ch) bios_putchar(ch); +#ifdef CONFIG_EARLY_PRINTK if (early_serial_base != 0) serial_putchar(ch); +#endif } void __attribute__((section(".inittext"))) puts(const char *str) -- 2.3.3.611.g09038fc.dirty -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/