mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Kuleshov <kuleshovmail@gmail.com>
To: Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>
Cc: linux-kernel@vger.kernel.org,
	Alexander Kuleshov <kuleshovmail@gmail.com>
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	[thread overview]
Message-ID: <1428318173-32607-1-git-send-email-kuleshovmail@gmail.com> (raw)

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 <kuleshovmail@gmail.com>
---
 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


                 reply	other threads:[~2015-04-06 11:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428318173-32607-1-git-send-email-kuleshovmail@gmail.com \
    --to=kuleshovmail@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®