public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] x86, setup: Check early serial console per string instead of one char
Date: Mon, 11 Oct 2010 10:50:58 -0700	[thread overview]
Message-ID: <4CB34E82.8030802@kernel.org> (raw)


Move out serial_putchar() calling out of putchar
Let puts() to call serial_putchar() directly.

So only need to check early_serial_base per string.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/boot/tty.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/x86/boot/tty.c
===================================================================
--- linux-2.6.orig/arch/x86/boot/tty.c
+++ linux-2.6/arch/x86/boot/tty.c
@@ -52,16 +52,22 @@ static void __attribute__((section(".ini
 void __attribute__((section(".inittext"))) putchar(int ch)
 {
 	if (ch == '\n')
-		putchar('\r');	/* \n -> \r\n */
+		bios_putchar('\r');	/* \n -> \r\n */
 
 	bios_putchar(ch);
-
-	if (early_serial_base != 0)
-		serial_putchar(ch);
 }
 
 void __attribute__((section(".inittext"))) puts(const char *str)
 {
+	if (early_serial_base) {
+		const char *s = str;
+		while (*s) {
+			if (*s == '\n')
+				serial_putchar('\r');
+			serial_putchar(*s++);
+		}
+	}
+
 	while (*str)
 		putchar(*str++);
 }

             reply	other threads:[~2010-10-11 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 17:50 Yinghai Lu [this message]
2010-10-11 18:19 ` [PATCH] x86, setup: Check early serial console per string instead of one char H. Peter Anvin
2010-10-11 19:47   ` Yinghai Lu
2010-10-11 19:56     ` H. Peter Anvin

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=4CB34E82.8030802@kernel.org \
    --to=yinghai@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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