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