From patchwork Sat Apr 11 14:42:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hurley X-Patchwork-Id: 6201641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F1A3F9F1C4 for ; Sat, 11 Apr 2015 14:54:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D4AF20295 for ; Sat, 11 Apr 2015 14:54:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 17FB02028D for ; Sat, 11 Apr 2015 14:54:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ygwkl-0005P8-Pu; Sat, 11 Apr 2015 14:51:23 +0000 Received: from mail-qk0-f171.google.com ([209.85.220.171]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Ygwki-0005NE-ND for linux-arm-kernel@lists.infradead.org; Sat, 11 Apr 2015 14:51:21 +0000 Received: by qkhg7 with SMTP id g7so82472724qkh.2 for ; Sat, 11 Apr 2015 07:50:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xyPdJzUBPZjqnZQBqHMbJsydrjBPemmqcfxq+f0YRos=; b=lfkeYK8XzIPUnbONg5jxEeITH2tel3WYGGK0VvmpeikDMrYjIJdsysmgOkMXA8Y/DE ECA5JVAcVgYp4Q+l7u4UUilspUbbAAMly3DzLOYVoHvadT2+G9JxOKUoyrp+3NiX8BrN YFPjA0Wr60bElVAU5W9B5bhA4qnzN/vtlfzamNd0vTELJDaBtwqGTRM100yv3RoeTXtl aMrL7//EV5xX2uDD6/xTQeDJR4INooRAvJ8wg64Eu6pLkZz9LvSz1Owh0HQvxBdFMhFn C8Tph//qLuSgnFkZ8RzRlGjBTUmW26MgxpXqp8UVQkXM5flQXQMe0TndANWg71F/BYPN g7Vw== X-Gm-Message-State: ALoCoQkBsFDfAhERu/j2wRNUJ3+4/hXKZudRGQFtH7AdDrMxZx4tZvhNK7miHKTxQCkNvWmtbM7R X-Received: by 10.55.21.224 with SMTP id 93mr12922038qkv.89.1428763370684; Sat, 11 Apr 2015 07:42:50 -0700 (PDT) Received: from thor.lan (h96-61-87-245.cntcnh.dsl.dynamic.tds.net. [96.61.87.245]) by mx.google.com with ESMTPSA id x66sm1533477qha.6.2015.04.11.07.42.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 11 Apr 2015 07:42:50 -0700 (PDT) From: Peter Hurley To: Greg Kroah-Hartman Subject: [PATCH] earlycon: Fix uart_parse_earlycon() if !CONFIG_SERIAL_CORE_CONSOLE Date: Sat, 11 Apr 2015 10:42:36 -0400 Message-Id: <1428763356-29158-1-git-send-email-peter@hurleysoftware.com> X-Mailer: git-send-email 2.3.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150411_075120_843137_3F205DBA X-CRM114-Status: GOOD ( 17.22 ) X-Spam-Score: -0.7 (/) Cc: linux-serial@vger.kernel.org, Arnd Bergmann , Chanwoo Choi , linux-kernel@vger.kernel.org, tfiga@google.com, Alim Akhtar , Peter Hurley , Jiri Slaby , linux-arm-kernel@lists.infradead.org, Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Arnd Bergmann wrote: > A configuration that enables earlycon but not the core console > code causes a link error: > > drivers/built-in.o: In function `setup_earlycon': > drivers/tty/serial/earlycon.c:70: undefined reference to `uart_parse_earlycon' CONFIG_SERIAL_EARLYCON should not require CONFIG_SERIAL_CORE_CONSOLE. Move uart_parse_earlycon() and compile if either CONFIG_SERIAL_CORE_CONSOLE or CONFIG_SERIAL_EARLYCON. Reported-by: Arnd Bergmann Signed-off-by: Peter Hurley --- NB: The diff moves everything else around uart_parse_earlycon() :/ drivers/tty/serial/serial_core.c | 90 ++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index eec067d..4d42b13 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1762,50 +1762,7 @@ static const struct file_operations uart_proc_fops = { }; #endif -#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) -/** - * uart_console_write - write a console message to a serial port - * @port: the port to write the message - * @s: array of characters - * @count: number of characters in string to write - * @putchar: function to write character to port - */ -void uart_console_write(struct uart_port *port, const char *s, - unsigned int count, - void (*putchar)(struct uart_port *, int)) -{ - unsigned int i; - - for (i = 0; i < count; i++, s++) { - if (*s == '\n') - putchar(port, '\r'); - putchar(port, *s); - } -} -EXPORT_SYMBOL_GPL(uart_console_write); - -/* - * Check whether an invalid uart number has been specified, and - * if so, search for the first available port that does have - * console support. - */ -struct uart_port * __init -uart_get_console(struct uart_port *ports, int nr, struct console *co) -{ - int idx = co->index; - - if (idx < 0 || idx >= nr || (ports[idx].iobase == 0 && - ports[idx].membase == NULL)) - for (idx = 0; idx < nr; idx++) - if (ports[idx].iobase != 0 || - ports[idx].membase != NULL) - break; - - co->index = idx; - - return ports + idx; -} - +#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_SERIAL_EARLYCON) /** * uart_parse_earlycon - Parse earlycon options * @p: ptr to 2nd field (ie., just beyond ',') @@ -1851,6 +1808,51 @@ int uart_parse_earlycon(char *p, unsigned char *iotype, unsigned long *addr, return 0; } EXPORT_SYMBOL_GPL(uart_parse_earlycon); +#endif + +#if defined(CONFIG_SERIAL_CORE_CONSOLE) || defined(CONFIG_CONSOLE_POLL) +/** + * uart_console_write - write a console message to a serial port + * @port: the port to write the message + * @s: array of characters + * @count: number of characters in string to write + * @putchar: function to write character to port + */ +void uart_console_write(struct uart_port *port, const char *s, + unsigned int count, + void (*putchar)(struct uart_port *, int)) +{ + unsigned int i; + + for (i = 0; i < count; i++, s++) { + if (*s == '\n') + putchar(port, '\r'); + putchar(port, *s); + } +} +EXPORT_SYMBOL_GPL(uart_console_write); + +/* + * Check whether an invalid uart number has been specified, and + * if so, search for the first available port that does have + * console support. + */ +struct uart_port * __init +uart_get_console(struct uart_port *ports, int nr, struct console *co) +{ + int idx = co->index; + + if (idx < 0 || idx >= nr || (ports[idx].iobase == 0 && + ports[idx].membase == NULL)) + for (idx = 0; idx < nr; idx++) + if (ports[idx].iobase != 0 || + ports[idx].membase != NULL) + break; + + co->index = idx; + + return ports + idx; +} /** * uart_parse_options - Parse serial port baud/parity/bits/flow control.