From patchwork Mon Jul 17 04:08:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 107867 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4046389qge; Sun, 16 Jul 2017 21:10:26 -0700 (PDT) X-Received: by 10.80.225.203 with SMTP id m11mr15900762edl.107.1500264626546; Sun, 16 Jul 2017 21:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500264626; cv=none; d=google.com; s=arc-20160816; b=mf99jqi1HWzfPEU6cc2DYQ6rXY9O5fqnEWcJPFMfmXMxTfoWoq5Xo3KJLfc4Stx0Kk fVZan8Pay1x+0hCy51rifqhOWKYl9Szp6Z9T7bNGU+2uanZnQL4fDV23hT3D3mhZX1x1 j6peSCXnw9CmTM/bP67mXFpnVx7gEhL7X/vT965c+WfHdMUz8oM91LYqa+JauvtfJqKb jngabIoUPcgsXMp7s1uVNw7kOyShqWm6uR+MFBO3D8m0T+NyTg1ftXjD3PBrKSsEmu0L 9E2X+4YkgdyC/pLvvkJp3L0+82Q4Qcx0cKX8Ewjjgdc8/c84mPcj/avwmJd8I+0c6olh ZK5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=ldkH4wH2atUkz3zLMrlHbB50As4l2msZ0cRKl0C3ntk=; b=zvbquFk6BBHvq950AaQY089Itfl6tjKR4zpPtNAfEiuIrf1h9y2t//tZlGj9PBN7Wm QRZqGTtjU8GzmYr/RMHRHM5d8AKFhvQzcjBNV/238MTAkEsiuFgBsiu7Pq3WVEnHRArg BOazMyBdnO6TshqAJfjoJXN1OEYM23mE1TABnFNedQcnvWevwWMIazXazNcfi98TJE+z 7VrdXjsqdqIuyjrn5k8+HonHM79WqaSz6kAnfQ0pbQlCz2aKaVAuOxKPVgt9NYmmrLk6 6XwYUPYurbROAkhoTgFZQugbpeeMWgW+HJlDGJyCZpZxkhwqKwGQOL/vyZXqlEZj9lJB Jr+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=pXtAyED8; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id r41si12724847edd.77.2017.07.16.21.10.26; Sun, 16 Jul 2017 21:10:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=pXtAyED8; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 1FA8DC21D8E; Mon, 17 Jul 2017 04:09:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 78EADC21D6C; Mon, 17 Jul 2017 04:09:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8D8A4C21C2A; Mon, 17 Jul 2017 04:09:17 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id 82334C21C2A for ; Mon, 17 Jul 2017 04:09:16 +0000 (UTC) Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-08.nifty.com with ESMTP id v6H48a6t030374; Mon, 17 Jul 2017 13:08:36 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v6H48a6t030374 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1500264517; bh=AQlhnmK15jshu3Sl36d5P5PpLL6nluXfY33VqX7J7CA=; h=From:To:Cc:Subject:Date:From; b=pXtAyED8NGlws8gyqGg2ISxRe6iZWM+YpcJQcimhxMnF9rS9DL1Xc0zWAV9VrCLEw 0/mN81+kp7YBIDQbIYZ9Vo6Dl0ZfP2meBp1v1f6Z0jnE8s/qUHG5heeyJYUSscUv4/ Y/rhznSyGBPxfguRNg/RPr9tUc7WTNG7U3UTPQ/Ka7+05OsnYoXgL1oPcJ0B3Fa0DC I6enPrLR1xM20Aojx1lnKZGIc5TpHK3nLOHyE+Xpnp7LFT/xyf4aYS7fh4tR0IDYCf PahlhvaxZg5rA1U3w3p6uSrlN81KfAQufuXTk3NCLFIWTkU4wLwhwfCZceH2YKxJW5 0fvNiMWCGG25A== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 17 Jul 2017 13:08:31 +0900 Message-Id: <1500264512-30507-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Cc: Stephen Warren Subject: [U-Boot] [PATCH 1/2] sandbox: remove os_putc() and os_puts() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" They are unused since commit d8c6fb8cedbc ("sandbox: Drop special case console code for sandbox"). Signed-off-by: Masahiro Yamada Acked-by: Simon Glass Acked-by: Simon Glass --- arch/sandbox/cpu/os.c | 11 ----------- include/os.h | 20 -------------------- 2 files changed, 31 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 7243bfc1b1fd..22d6aab53481 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -413,17 +413,6 @@ int os_get_filesize(const char *fname, loff_t *size) return 0; } -void os_putc(int ch) -{ - putchar(ch); -} - -void os_puts(const char *str) -{ - while (*str) - os_putc(*str++); -} - int os_write_ram_buf(const char *fname) { struct sandbox_state *state = state_get_current(); diff --git a/include/os.h b/include/os.h index 049b248c5b01..2bf4bdb1b836 100644 --- a/include/os.h +++ b/include/os.h @@ -241,26 +241,6 @@ const char *os_dirent_get_typename(enum os_dirent_t type); int os_get_filesize(const char *fname, loff_t *size); /** - * Write a character to the controlling OS terminal - * - * This bypasses the U-Boot console support and writes directly to the OS - * stdout file descriptor. - * - * @param ch Character to write - */ -void os_putc(int ch); - -/** - * Write a string to the controlling OS terminal - * - * This bypasses the U-Boot console support and writes directly to the OS - * stdout file descriptor. - * - * @param str String to write (note that \n is not appended) - */ -void os_puts(const char *str); - -/** * Write the sandbox RAM buffer to a existing file * * @param fname Filename to write memory to (simple binary format) From patchwork Mon Jul 17 04:08:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 107866 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4045694qge; Sun, 16 Jul 2017 21:09:23 -0700 (PDT) X-Received: by 10.80.165.104 with SMTP id z37mr15978748edb.60.1500264563877; Sun, 16 Jul 2017 21:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500264563; cv=none; d=google.com; s=arc-20160816; b=f8O6gvdB4qybF99pSpE/w0x/x7obfnVDHjRg7R4nWZi1Iilo5cEdoYqoTK8uw8SA5C 1e9/lsjSewfBdJkLEcA0yZHhQZKAQzpBDJ3TuGQa2ud9XNV1EjBjJCTRC+jHtMLNZ+og pkLM2SRHI6/LMVcjCd8eOtHT7/PtK0HQ64yKl2nAjpber48KPtw5NK86cQAcKfpdUeoA H6kawiuU/aWgrLVpv5aJckCLY8Q0ixV4pJ1KeUzxORhTie7KbpMMs2tSMOmFIR8HstSv X4daakLiTrPAUp6vyXMnsOKiQiC1RL+RbBXKtyNWzlvhTRvfpkyESSUXh3HA0U8sCqtS iq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:dkim-signature:dkim-filter:arc-authentication-results; bh=sKxrU0wbF7fCJcOuMZa5tPqmnC2Csfdm/FirdGYaMws=; b=v0USlzCUYrLSfSG6uaLgGHh46T9O0HiE9zbIAKtoEAjei1B/2fCVprfWKDANztja72 tTjSOZhdWwjRzqeK7hkJCtT6DOWQRYihvba2rRgfw9p8Ui/X+F6/+Lbi4XIBI/miqgDT 6+J2vUQifEahQhDAPG5aexEwnQl7xqm+afBjEFsTW2tp5qFRJCWqAaa274BlzW56RM3s KE0aQ2CIww2XGoUDoKXNf0Lna0YItUNHuyP0KP3LsNyOh6t/BJbxyuMDKfE0Zd7sKetQ ajCMamypnNmN9a2QA2VRzT7ZpWrBvZy5B3g5YTZu7nKG30URKWLxgz2smdjcxF8+zK2u yz2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=p+O4O84l; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id a53si13292546edc.280.2017.07.16.21.09.23; Sun, 16 Jul 2017 21:09:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.b=p+O4O84l; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 66FFCC21DBC; Mon, 17 Jul 2017 04:09:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C4675C21C39; Mon, 17 Jul 2017 04:09:19 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 8476EC21C4C; Mon, 17 Jul 2017 04:09:17 +0000 (UTC) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lists.denx.de (Postfix) with ESMTPS id A1A19C21C39 for ; Mon, 17 Jul 2017 04:09:16 +0000 (UTC) Received: from grover.sesame (FL1-122-131-185-176.osk.mesh.ad.jp [122.131.185.176]) (authenticated) by conuserg-08.nifty.com with ESMTP id v6H48a6u030374; Mon, 17 Jul 2017 13:08:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v6H48a6u030374 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1500264517; bh=Y650+JJoabpYSHIa9Qk9Spokg18WhWUTg7dj2Lyr27Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+O4O84lPU8mF18sQLRTAYpF1LX+p4atyAS6OJ3GO5WRFGjlnDzs8z9eREvEwHQwk osGyd6bLdoMT2Kmm020u/njQ7mQiT8H4yXUqb3+yC7ck4T+YWVDOB8Rpsa60Hai5aF EJwNXPcpwsg1Y3dBdhRtWoibaoZxMZVaqyYcka6kAP/PiK6kcWkvPrBCtwI9d843OH GvZKvJBQEiYPcsL1qgx/gbwgb0x+F9Ev/Q9x5uMsj2mLvo8rhwP7I++EiHC3vkC0Qj rRQv97f1eS8meeKTpXVwlbDzZIYwCj4DubU2P0UcxwdAWIEqnjc920qI6Ray0XTr5B Bac2ilyeaolQQ== X-Nifty-SrcIP: [122.131.185.176] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 17 Jul 2017 13:08:32 +0900 Message-Id: <1500264512-30507-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500264512-30507-1-git-send-email-yamada.masahiro@socionext.com> References: <1500264512-30507-1-git-send-email-yamada.masahiro@socionext.com> Cc: Stephen Warren , Jan Kiszka , "Andreas J. Reichel" , Jagan Teki , Chris Packham Subject: [U-Boot] [PATCH 2/2] console: simplify puts() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Current puts() and putc() have similar #ifdef / if() conditionals. Make puts() iterate over putc() to avoid code duplication. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- common/console.c | 44 ++------------------------------------------ 1 file changed, 2 insertions(+), 42 deletions(-) diff --git a/common/console.c b/common/console.c index c6156f33bbbe..01eef5594fcb 100644 --- a/common/console.c +++ b/common/console.c @@ -426,12 +426,6 @@ static void pre_console_putc(const char c) unmap_sysmem(buffer); } -static void pre_console_puts(const char *s) -{ - while (*s) - pre_console_putc(*s++); -} - static void print_pre_console_buffer(int flushpoint) { unsigned long in = 0, out = 0; @@ -459,7 +453,6 @@ static void print_pre_console_buffer(int flushpoint) } #else static inline void pre_console_putc(const char c) {} -static inline void pre_console_puts(const char *s) {} static inline void print_pre_console_buffer(int flushpoint) {} #endif @@ -501,41 +494,8 @@ void putc(const char c) void puts(const char *s) { -#ifdef CONFIG_DEBUG_UART - if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) { - while (*s) { - int ch = *s++; - - printch(ch); - } - return; - } -#endif -#ifdef CONFIG_CONSOLE_RECORD - if (gd && (gd->flags & GD_FLG_RECORD) && gd->console_out.start) - membuff_put(&gd->console_out, s, strlen(s)); -#endif -#ifdef CONFIG_SILENT_CONSOLE - if (gd->flags & GD_FLG_SILENT) - return; -#endif - -#ifdef CONFIG_DISABLE_CONSOLE - if (gd->flags & GD_FLG_DISABLE_CONSOLE) - return; -#endif - - if (!gd->have_console) - return pre_console_puts(s); - - if (gd->flags & GD_FLG_DEVINIT) { - /* Send to the standard output */ - fputs(stdout, s); - } else { - /* Send directly to the handler */ - pre_console_puts(s); - serial_puts(s); - } + while (*s) + putc(*s++); } #ifdef CONFIG_CONSOLE_RECORD