From patchwork Thu Nov 1 21:46:27 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Hershberger X-Patchwork-Id: 196389 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 34DDF2C00AE for ; Fri, 2 Nov 2012 08:47:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7E0664A63D; Thu, 1 Nov 2012 22:47:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8myMMGgNkfw2; Thu, 1 Nov 2012 22:47:26 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C9F344A63F; Thu, 1 Nov 2012 22:47:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8EE3A4A633 for ; Thu, 1 Nov 2012 22:47:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Lf88GjNBpJmJ for ; Thu, 1 Nov 2012 22:47:09 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from spamkiller05.natinst.com (mailserver5.natinst.com [130.164.80.5]) by theia.denx.de (Postfix) with ESMTP id EFD734A635 for ; Thu, 1 Nov 2012 22:47:07 +0100 (CET) Received: from mailserv58-us.natinst.com (nb-hsrp-1338.natinst.com [130.164.19.133]) by spamkiller05.natinst.com (8.14.5/8.14.5) with ESMTP id qA1LkpjT031394; Thu, 1 Nov 2012 16:46:51 -0500 Received: from linux-xvxi.natinst.com ([130.164.14.197]) by mailserv58-us.natinst.com (Lotus Domino Release 8.5.3FP2 HF169) with ESMTP id 2012110116465156-895143 ; Thu, 1 Nov 2012 16:46:51 -0500 From: Joe Hershberger To: u-boot@lists.denx.de Date: Thu, 1 Nov 2012 16:46:27 -0500 Message-Id: <1351806388-27322-1-git-send-email-joe.hershberger@ni.com> X-Mailer: git-send-email 1.7.11.5 X-MIMETrack: Itemize by SMTP Server on MailServ58-US/AUS/H/NIC(Release 8.5.3FP2 HF169|September 14, 2012) at 11/01/2012 04:46:51 PM, Serialize by Router on MailServ58-US/AUS/H/NIC(Release 8.5.3FP2 HF169|September 14, 2012) at 11/01/2012 04:46:51 PM, Serialize complete at 11/01/2012 04:46:51 PM X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.7.7855, 1.0.431, 0.0.0000 definitions=2012-11-01_06:2012-11-01, 2012-11-01, 1970-01-01 signatures=0 Cc: Tom Rini , Joe Hershberger Subject: [U-Boot] [PATCH 1/2] serial: Remove the "serial" console device X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Each serial device is added as a console device. There was also the "serial" device that points to the most-recently-assigned-to-some- console-handle device. This can be confusing. Instead, only show the actual serial devices. Signed-off-by: Joe Hershberger --- common/console.c | 37 +++++++++++++++++++------------------ common/stdio.c | 12 +----------- 2 files changed, 20 insertions(+), 29 deletions(-) diff --git a/common/console.c b/common/console.c index 1177f7d..9cc8197 100644 --- a/common/console.c +++ b/common/console.c @@ -26,6 +26,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -550,6 +551,7 @@ int console_assign(int file, const char *devname) { int flag; struct stdio_dev *dev; + const char *realdevname; /* Check for valid file */ switch (file) { @@ -565,8 +567,12 @@ int console_assign(int file, const char *devname) } /* Check for valid device name */ + if (strcmp(devname, "serial") == 0) + realdevname = default_serial_console()->name; + else + realdevname = devname; - dev = search_device(flag, devname); + dev = search_device(flag, realdevname); if (dev) return console_setfile(file, dev); @@ -657,13 +663,16 @@ int console_init_r(void) } /* if the devices are overwritten or not found, use default device */ if (inputdev == NULL) { - inputdev = search_device(DEV_FLAGS_INPUT, "serial"); + inputdev = search_device(DEV_FLAGS_INPUT, + default_serial_console()->name); } if (outputdev == NULL) { - outputdev = search_device(DEV_FLAGS_OUTPUT, "serial"); + outputdev = search_device(DEV_FLAGS_OUTPUT, + default_serial_console()->name); } if (errdev == NULL) { - errdev = search_device(DEV_FLAGS_OUTPUT, "serial"); + errdev = search_device(DEV_FLAGS_OUTPUT, + default_serial_console()->name); } /* Initializes output console first */ if (outputdev != NULL) { @@ -713,18 +722,10 @@ int console_init_r(void) struct list_head *pos; struct stdio_dev *dev; -#ifdef CONFIG_SPLASH_SCREEN - /* - * suppress all output if splash screen is enabled and we have - * a bmp to display. We redirect the output from frame buffer - * console to serial console in this case or suppress it if - * "silent" mode was requested. - */ - if (getenv("splashimage") != NULL) { - if (!(gd->flags & GD_FLG_SILENT)) - outputdev = search_device (DEV_FLAGS_OUTPUT, "serial"); - } -#endif + outputdev = search_device(DEV_FLAGS_OUTPUT, + default_serial_console()->name); + inputdev = search_device(DEV_FLAGS_INPUT, + default_serial_console()->name); /* Scan devices looking for input and output devices */ list_for_each(pos, list) { @@ -760,13 +761,13 @@ int console_init_r(void) gd->flags |= GD_FLG_DEVINIT; /* device initialization completed */ - stdio_print_current_devices(); - /* Setting environment variables */ for (i = 0; i < 3; i++) { setenv(stdio_names[i], stdio_devices[i]->name); } + stdio_print_current_devices(); + #if 0 /* If nothing usable installed, use only the initial console */ if ((stdio_devices[stdin] == NULL) && (stdio_devices[stdout] == NULL)) diff --git a/common/stdio.c b/common/stdio.c index 605ff3f..e9bdc0e 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -70,21 +70,11 @@ int nulldev_input(void) static void drv_system_init (void) { +#ifdef CONFIG_SYS_DEVICE_NULLDEV struct stdio_dev dev; memset (&dev, 0, sizeof (dev)); - strcpy (dev.name, "serial"); - dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; - dev.putc = serial_putc; - dev.puts = serial_puts; - dev.getc = serial_getc; - dev.tstc = serial_tstc; - stdio_register (&dev); - -#ifdef CONFIG_SYS_DEVICE_NULLDEV - memset (&dev, 0, sizeof (dev)); - strcpy (dev.name, "nulldev"); dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; dev.putc = nulldev_putc;