From patchwork Thu Nov 16 09:22:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 119031 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5360113qgn; Thu, 16 Nov 2017 01:27:31 -0800 (PST) X-Google-Smtp-Source: AGs4zMa/AM8e1f+he06s0UeZfx7VxSE9HAavL/x+/rIOy4zmxpmhe3RuwzMlG2foGEgT4rAblP00 X-Received: by 10.80.166.196 with SMTP id f4mr1849040edc.278.1510824451082; Thu, 16 Nov 2017 01:27:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510824451; cv=none; d=google.com; s=arc-20160816; b=MJmSaJA41JjeTKUy6MYNMaRMyiExPxpLQh8HedcO6F0yjFFTlonSl3W49+g7lpMyYF w67I97TTeGE9wnF4p1vrJqUFEeF4qEaNWyiDIvGVX9pDB7aq1EVUPlJ/pKbiCIQ9icIe ZTaXmD59ap5c0hZzOdzVNlP4nv2QLvzfLcMfXwPkiyQxLPRitU/Ozd7qvYO3n9j78zEV 9LI4195V37Ytd8EhUOQ9SDqQx8phaupqmLX7yFFTGD/DRcR+CXJ1Hiqgnts5H/wOPjsX GCy9bFJbhK1rpaExHdZsTl6vICFkqT32u4Qy3fLWh8MCDX6GJ/t0Css0c+ZASA3sbQB8 xszg== 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:arc-authentication-results; bh=RHvP45mXGP+Yz8WIWvHRbQfIY1SgK0WQjw646HJDNqk=; b=RhDwnp1NRWsvTq4nvIXY5UL9SIsBNHxfugHuWA9CzNxq2avhUhBbZb0IW8Gx7Ddb+R ttL6Nu778ea/me97R6FiLSixuGDsZP2noGg4O1dRG74zCuc10mX07zbg61k0lxo6cshP 6tIlXiuCNYRMpgwYVxOmKRzgKULQMzUMAJgOsOfXH8DhrH3hefrD7iP+uOKSjFvW6Gij FQ/GaUmPwxibfLVsKcwoyQnHpM8WylH8iHu3fxyK9n/OF8GanjNiWrAcMhV/jFKdph/B 5BiPRfE0txAHDxPp4GQPHQn2MUMPyBu104JFR9zDu4yPheooMAwuidnBEvjZ2BP386ou LGRA== ARC-Authentication-Results: i=1; mx.google.com; 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 e32si871638edd.76.2017.11.16.01.27.30; Thu, 16 Nov 2017 01:27:31 -0800 (PST) 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; 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 9A468C21DF3; Thu, 16 Nov 2017 09:23:26 +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=none 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 33383C21DB2; Thu, 16 Nov 2017 09:22:51 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E51A9C21D80; Thu, 16 Nov 2017 09:22:47 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 790D4C21D6A for ; Thu, 16 Nov 2017 09:22:47 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 704F0213E3; Thu, 16 Nov 2017 10:22:46 +0100 (CET) Received: from localhost (unknown [185.94.189.187]) by mail.free-electrons.com (Postfix) with ESMTPSA id 2963E2055E; Thu, 16 Nov 2017 10:22:36 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Thu, 16 Nov 2017 10:22:22 +0100 Message-Id: <20171116092231.27740-2-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171116092231.27740-1-maxime.ripard@free-electrons.com> References: <20171116092231.27740-1-maxime.ripard@free-electrons.com> Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [RFC PATCH 01/10] cmd: nvedit: Get rid of the env lookup 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" The nvedit command is the only user of env_driver_lookup_default outside of the environment code itself, and it uses it only to print the environment it's about to save to during env save. As we're about to rework the environment to be able to handle multiple environment sources, we might not have an idea of what environment backend is going to be used before trying (and possibly failing for some). Therefore, it makes sense to remove that message and move it to the env_save function itself. As a side effect, we also can get rid of the call to env_driver_lookup default that is also about to get refactored. Signed-off-by: Maxime Ripard Reviewed-by: Lukasz Majewski --- cmd/nvedit.c | 4 ---- env/env.c | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 4e79d03856fe..a690d743cd46 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -708,10 +708,6 @@ ulong env_get_ulong(const char *name, int base, ulong default_val) static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - struct env_driver *env = env_driver_lookup_default(); - - printf("Saving Environment to %s...\n", env->name); - return env_save() ? 1 : 0; } diff --git a/env/env.c b/env/env.c index 76a5608628fc..84c12e27bc3f 100644 --- a/env/env.c +++ b/env/env.c @@ -115,6 +115,8 @@ int env_save(void) return -ENODEV; if (!drv->save) return -ENOSYS; + + printf("Saving Environment to %s...\n", drv->name); ret = drv->save(); if (ret) { debug("%s: Environment failed to save (err=%d)\n", __func__,