From patchwork Tue Jul 17 22:09:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 142224 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp96136ljj; Tue, 17 Jul 2018 15:09:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdQ4opu07oll/UrCxU1T9Ea+5fqTzPBN4l60kNJiaPFPG4uQz8CY3+9Ndq1wc/SormPvBqo X-Received: by 2002:aa7:d385:: with SMTP id x5-v6mr4367689edq.104.1531865362147; Tue, 17 Jul 2018 15:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531865362; cv=none; d=google.com; s=arc-20160816; b=LEDgNULbFvRCe0reVN7qA5zQbFH4SdUVN9pwjoHpbUUQnDQpn6bIecMVt6crxXdsDp Nh9rmqdYD8ypc+0WIcAX9LySDhA25j1Z3Sas+N/TTpgUPvpbbipAyVbEd8ht/0QBkKG5 luWEca/uwiYiGaSREWOPq/gxX2n6UG8Puex/5occ8NMStv4V5VVCVbZOo7Zj2Lg46PKn U6RsMX5+J62eWiSoFRMjie4PuFAwZ3rVI0UhNyuOcldfn1WUxH4HIWUGYgr/0h7gXEzs rq8fFMMc/fGuli35hVbrVvpNuDTDQ/Y1udI28hr75jFAov5/6jK6ibn7NkXNs8O6lMz7 fdEQ== 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:arc-authentication-results; bh=UWXDNAa4oRq5xp5Kn2KfCVtInd7oWr9PrEjYXRVmHUQ=; b=YUY9cnqfcH3jWH6kocfMiRFGoS+N85iQ93y28wWdPnpZdYG2UQ+V9TvBZLQYbiYfHo DCXh8KiTZWUHgrFwE8L/gkMzeSj6g6Dk1xP2eYKSqkeDm/gbGk45cRYuvG10cY9/nDIB xj3G1BM43Sb1h7+uVursF9/CDQMUBnDG3bQdmoW1Kt6rklEV7NhC8de6M62IQbZD54Cb 4+GM8PmaYDRf952hBhgoBMQYEAASIFHv/jyzvoy3YldViSNRTZ0wR8pp6+3oa+u//EzP iFJRfZ9mPuFlfLD5+BTJudle4h28TtLvmqYHqEtiFpmwQJqSLkvLwO3laRsTb7l2oro4 AGUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Okce2E59; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id y8-v6si71876edk.369.2018.07.17.15.09.21; Tue, 17 Jul 2018 15:09:22 -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=@linaro.org header.s=google header.b=Okce2E59; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id B483EC21E9F; Tue, 17 Jul 2018 22:09:19 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 00DBBC21C3F; Tue, 17 Jul 2018 22:09:17 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C2EC5C21C27; Tue, 17 Jul 2018 22:09:15 +0000 (UTC) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com [209.85.215.46]) by lists.denx.de (Postfix) with ESMTPS id 5FA96C21BE5 for ; Tue, 17 Jul 2018 22:09:15 +0000 (UTC) Received: by mail-lf0-f46.google.com with SMTP id u202-v6so1958997lff.9 for ; Tue, 17 Jul 2018 15:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=ko0DctIHf/QnTjptFdftBPduMVeRoDZQQNjM7btW1PE=; b=Okce2E594UokKZ49LmlYqf1L1X/vjIMq5C7GhuEK3r9ebF38avH9loDr1A5nvG+kR/ BRNGgncqJj7bQjQSnRNOGw0H9ndkxClnsPbXb3qF9Y2HJ5s7MSUmKu/jSSqBzicwfls1 2hpL4WQ1r7Ek6BxDNXJgd4SSIxuUD7Sd5GZ9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ko0DctIHf/QnTjptFdftBPduMVeRoDZQQNjM7btW1PE=; b=hhMhkKAZcYYKaql0khhKuBIQTb8fp3S24bMx10weGFvgy/3tfa4jmecVT1UmgHppZy 3Z7GGmJ9/pqaasFwbVkdF9TCwUUyiNuYIZYYRGZML41rE1Dc6ABfctgsaqN3nxKrpggx K1umj/Th8VPW/xoOVNvjGotLL4lYtjTUxRfGH1yI6FTdf/yZyTDDXyCsFyRWLzBjDmkx 2PDXSc03A6aimXsGQgKgeTL723XsERXm6aqkZbI+LWV8ePFoLl0Lh3Kk8ryQX/8HWpfw X/+3Rv3Wf4UaNNSkuYPGK+tK2QPLIRbPkPrJeT4pzvyy+sIGpUngR1WA6aF4ZaHFuaVR pOCw== X-Gm-Message-State: AOUpUlHxwgGYOwdDRXLeKo2sw6gZQ6ueIawMImMdKgJz1JvfPtaT0Lam AsGOYmMVA/TnmvaL0pmJa3NcCnoxn/4= X-Received: by 2002:a19:d98f:: with SMTP id s15-v6mr2369929lfi.103.1531865354472; Tue, 17 Jul 2018 15:09:14 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id b141-v6sm300969lfb.6.2018.07.17.15.09.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jul 2018 15:09:13 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Wed, 18 Jul 2018 01:09:11 +0300 Message-Id: <20180717220912.11358-1-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.18.0 Cc: Tom Rini , Maxime Ripard Subject: [U-Boot] [RFC 1/2] env: Drop error messages when loading environment 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" This is just a draft to discuss ideas related to "Make U-Boot log great again" thread. With this patch we will have something like this: Loading Environment from FAT... Failed (-5) Loading Environment from MMC... OK instead of this: Loading Environment from FAT... MMC: no card present ** Bad device mmc 0 ** Failed (-5) Loading Environment from MMC... OK Signed-off-by: Sam Protsenko --- env/env.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/env/env.c b/env/env.c index 5c0842ac07..85598fa5d4 100644 --- a/env/env.c +++ b/env/env.c @@ -187,6 +187,7 @@ int env_load(void) for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) { int ret; + unsigned long have_console = gd->have_console; if (!drv->load) continue; @@ -195,7 +196,11 @@ int env_load(void) continue; printf("Loading Environment from %s... ", drv->name); + + /* Suppress console output for drv->load() */ + gd->have_console = 0; ret = drv->load(); + gd->have_console = have_console; if (ret) printf("Failed (%d)\n", ret); else From patchwork Tue Jul 17 22:09:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Protsenko X-Patchwork-Id: 142225 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp96559ljj; Tue, 17 Jul 2018 15:09:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpekrhqDnbZneI3jzUjr0q2pDhU4UHFmK4cRTFCt+jip+H4kyvkAyc8hvT1Hx6da0hQuMoA0 X-Received: by 2002:a50:b7db:: with SMTP id i27-v6mr4271256ede.284.1531865393248; Tue, 17 Jul 2018 15:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531865393; cv=none; d=google.com; s=arc-20160816; b=zzvFjnH+/9qyQzE6+gAzKtB6MMGbpD669IDU7xuGCPqVKvdggAKAdcraSZcGT9wVgt yjKct7LBq4YQRRVbCplOQsERbqUM3F6DxdHfBXVgNM/J5r4V0HDLFHX66kTkdkg95amT wLQavDvsQ9yT9pz2hEHnBfNQRdgzDxomGKzrfwMjKVwqqTcbBi+TOLFTWBSRUp2Cqb9f nR34uQ3HqP3X5LFb60MJ9CfN4Ur/eNpJz9HvNerGQn0L3RqRNMzGVYtyWb08J7LYpr8B 5AE+SV8lTBY2mCb44eiAZN1uy2BLoasSY2yv+xEDf61fxzNyfdn3WvdcRZGm70OGUDR4 IreA== 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:arc-authentication-results; bh=HzeKL/JIT3O5j3wNNi0iFG3Ju/UAKREVA9MsFkvBJ3g=; b=qRrIeTgIXPDrJJnIWmb+8xYkGUK55d6aD5Ck8YtesZJS6EKJrZw4ByJ0/483ffEDPL fOkqGRhNc/p/P0+zCNWl9xqmjD1De5Vmhfxep0KBX9aHS1pWLKRAimNn154Fbt7u5YGt nsJV2+zRaz/KB5+cyP39W7jWcJR4OwY4v3Ij+7CfZwPz+8me0C9oiDvd5u7WQ9hphe1N 9uvmlUpLK6Jseb8sj1ncolowNIhwQh5rCTBIYeRQUGWCKJkESBUzg4sc/wUtLKzKyfrx 1BbOPdDH6MMSop6kI4ETxkNkuwOcmZqBa49TM60LPRd6vSuZtqIUxgyy/S5Lv6asYLxB JaxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iVSQFEsG; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id i57-v6si1168442eda.238.2018.07.17.15.09.53; Tue, 17 Jul 2018 15:09:53 -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=@linaro.org header.s=google header.b=iVSQFEsG; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.denx.de (Postfix, from userid 105) id DDF6FC21DFF; Tue, 17 Jul 2018 22:09:36 +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=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 D457AC21E68; Tue, 17 Jul 2018 22:09:18 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 274FBC21DDC; Tue, 17 Jul 2018 22:09:17 +0000 (UTC) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by lists.denx.de (Postfix) with ESMTPS id BE499C21BE5 for ; Tue, 17 Jul 2018 22:09:16 +0000 (UTC) Received: by mail-lf0-f68.google.com with SMTP id b22-v6so1967802lfa.3 for ; Tue, 17 Jul 2018 15:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LDodUy/2tz6GpU4mHXbgl6YwnruCviRqtSbki5lTGpY=; b=iVSQFEsG8U9jghWzEB14yguYo74tVqm5Gz4YkMV/M7fZ+H69eBjmRvhtXTl+VzRG05 ZaPVgJ0gqN6/tJUBqlpkWfBiXqSquzB0tM8KSSnisWB7YRIGHtOXoSsfEGi6WNz+ZXIP td8wHms7bMowqM7k7akHsnfC92N3Q+RV/43k8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LDodUy/2tz6GpU4mHXbgl6YwnruCviRqtSbki5lTGpY=; b=OPZSa5TObTJwNVsgcptrUlURYwAYxXQskiP8Sw0ozzkG6DPDxuhNxI1Qw5HbFfm9wx 25sL2kWFMjJvXUs+htgrpLLdBF//j87+qq5iBUYsr9lmLkUo2Gcgn/M7LD8bZhyAUNe/ XcHRP1H+iI0EI6/B8pPlA3KO83XTFAsZQ78ycW9PKNPJwBq0NQKplnV1b1Z8fNZDvUIr JMreGi+KfvMnm5E+Itxz1rje/HcNm2R5vVt5OFkdWjXzMF0/RYQCy6BznkEgU+XwLge0 /J3xeMes+ZEyd6D9dGj2R+oVibUTBVMJHirSSxnpYNUyE74j35q3SHJfXnsptcb2qArP L3rA== X-Gm-Message-State: AOUpUlGwJaZ86NcKb9zx7IXapLSBeuO+TFsJq7efloUd1ZGJzBUE5pYz g2+CcWIwgGuR0rwUWOvSbriErzDOMk0= X-Received: by 2002:a19:d819:: with SMTP id p25-v6mr2232890lfg.36.1531865355934; Tue, 17 Jul 2018 15:09:15 -0700 (PDT) Received: from localhost ([195.238.92.132]) by smtp.gmail.com with ESMTPSA id d24-v6sm299209lfl.53.2018.07.17.15.09.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jul 2018 15:09:15 -0700 (PDT) From: Sam Protsenko To: u-boot@lists.denx.de Date: Wed, 18 Jul 2018 01:09:12 +0300 Message-Id: <20180717220912.11358-2-semen.protsenko@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180717220912.11358-1-semen.protsenko@linaro.org> References: <20180717220912.11358-1-semen.protsenko@linaro.org> Cc: Tom Rini , Maxime Ripard Subject: [U-Boot] [RFC 2/2] env: Add prefix to error messages when loading env 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" This is just a draft to discuss ideas related to "Make U-Boot log great again" thread. With this patch we will see something like: Loading Environment from FAT... --> MMC: no card present --> ** Bad device mmc 0 ** --> Failed (-5) Loading Environment from MMC... --> OK instead of: Loading Environment from FAT... MMC: no card present ** Bad device mmc 0 ** Failed (-5) Loading Environment from MMC... OK Signed-off-by: Sam Protsenko --- common/console.c | 8 ++++++++ env/env.c | 4 +++- include/asm-generic/global_data.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/console.c b/common/console.c index 2ba33dc574..1bbafa33a1 100644 --- a/common/console.c +++ b/common/console.c @@ -533,6 +533,14 @@ void putc(const char c) void puts(const char *s) { + if (gd->pr_prefix) { + const char *prefix = gd->pr_prefix; + + gd->pr_prefix = NULL; + puts(prefix); + gd->pr_prefix = prefix; + } + #ifdef CONFIG_DEBUG_UART if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) { while (*s) { diff --git a/env/env.c b/env/env.c index 5c0842ac07..56a105ea55 100644 --- a/env/env.c +++ b/env/env.c @@ -194,12 +194,14 @@ int env_load(void) if (!env_has_inited(drv->location)) continue; - printf("Loading Environment from %s... ", drv->name); + printf("Loading Environment from %s...\n", drv->name); + gd->pr_prefix = " --> "; ret = drv->load(); if (ret) printf("Failed (%d)\n", ret); else printf("OK\n"); + gd->pr_prefix = NULL; if (!ret) return 0; diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 0fd4900392..32b80db96b 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -44,6 +44,7 @@ typedef struct global_data { unsigned long board_type; #endif unsigned long have_console; /* serial_init() was called */ + const char *pr_prefix; /* print prefix before message */ #if CONFIG_IS_ENABLED(PRE_CONSOLE_BUFFER) unsigned long precon_buf_idx; /* Pre-Console buffer index */ #endif