From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933171AbbGGUWT (ORCPT ); Tue, 7 Jul 2015 16:22:19 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:51200 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932672AbbGGUU7 (ORCPT ); Tue, 7 Jul 2015 16:20:59 -0400 From: Yinghai Lu To: Kees Cook , "H. Peter Anvin" , Baoquan He Cc: linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH 22/42] x86, setup: Check early serial console per string instead of one char Date: Tue, 7 Jul 2015 13:20:08 -0700 Message-Id: <1436300428-21163-23-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1436300428-21163-1-git-send-email-yinghai@kernel.org> References: <1436300428-21163-1-git-send-email-yinghai@kernel.org> X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/x86/boot/tty.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c index def2451..114caea 100644 --- a/arch/x86/boot/tty.c +++ b/arch/x86/boot/tty.c @@ -52,16 +52,22 @@ static void __attribute__((section(".inittext"))) bios_putchar(int ch) 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++); } -- 1.8.4.5