From patchwork Tue Jan 16 09:16:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 124643 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp948633lje; Tue, 16 Jan 2018 01:25:21 -0800 (PST) X-Google-Smtp-Source: ACJfBotKdu+YmRkunrHlwfG63t34uaUtxFXIdjPXyacRxuj9W3Sy9tfqA+5MUVzYUvZvzZFOHAGr X-Received: by 10.80.246.21 with SMTP id c21mr33884681edn.271.1516094721351; Tue, 16 Jan 2018 01:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516094721; cv=none; d=google.com; s=arc-20160816; b=PLjLK5p2XKNlBhyP/VqwkdTJRAiTHr/3u/OSYFl39q6vHgu0k8ceufwaGjYtFpopQq iajopOfOKCJ/ZLaYGIeljwRPqx4gGNPp78c6HeZKfOBVQZJ8Q8Nj9vajSY6tQH4OK+SY OdFZPay+mulIBBAKE0HQhQPAioY/Ie+dBfeI6TDZLxUsB5TFpxgZMM7gYrQq5o97lFUE 5txS/QgitykjtNScDYAwgzgfUQdhmXetnt+O6HLnQH50JcksmRTBSRlbkeG4gl2BoxbQ p/MCwb9NGHhhul10oR2BO6zsA528Vwi9VUzWG8volvJ9VD/RUN6vPKNvX0kEU9bcyoi6 3RpA== 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:references :in-reply-to:message-id:date:to:from:arc-authentication-results; bh=olmVkPtQUpCd6/0LgGcBiBRXX+R7DJmzVP+YOZETsko=; b=kwHWMLi13Zx2pvR89nxf5aSeaHwXdH+X0o4ep1V1mT9me1/o6ZXhJkHly0TmKYXGEw G4QryvIiOcxV7q5mZn9E7qcpA8hrCiUaRWPwfwlB9jppd0AT85EChn6kjoqFgr6jARfp DL8SWv4/PHJRa/6Z+AlMVU/8vZPT9CmPYsG9EXFgYopJNHWTnRlxbYMNjN312wbfxQpb Qaoiu2PrqF3T4nV1bzVephj8vYKVLZXrpc06Jr5aVk8CmszdOF5aBWAYxfxQ4E2WGTME HMHloZBCc9uUHSmHyc6Ispel9Pcqbq2DTl/Ce5OaLJuqJKSuNbKJMza4t9lBHl6hM6y7 qxQA== 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 6si1719651edm.187.2018.01.16.01.25.21; Tue, 16 Jan 2018 01:25:21 -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 F22D2C21E4B; Tue, 16 Jan 2018 09:17:57 +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 574BDC21DF3; Tue, 16 Jan 2018 09:16:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7FD29C21DB5; Tue, 16 Jan 2018 09:16:55 +0000 (UTC) Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by lists.denx.de (Postfix) with ESMTP id 34BACC21C4A for ; Tue, 16 Jan 2018 09:16:55 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 00EF0208BB; Tue, 16 Jan 2018 10:16:53 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id C08FE20725; Tue, 16 Jan 2018 10:16:53 +0100 (CET) From: Maxime Ripard To: Tom Rini Date: Tue, 16 Jan 2018 10:16:37 +0100 Message-Id: <8c0b36130b265e429f5ad0887c339776e4d47912.1516094113.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Andre Przywara , agraf@suse.de, u-boot@lists.denx.de, Maxime Ripard , Jagan Teki Subject: [U-Boot] [PATCH v2 01/15] 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. Reviewed-by: Andre Przywara Reviewed-by: Lukasz Majewski Reviewed-by: Simon Glass Signed-off-by: Maxime Ripard --- cmd/nvedit.c | 4 ---- env/env.c | 4 +++- include/environment.h | 7 ------- 3 files changed, 3 insertions(+), 12 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..094538ff5b62 100644 --- a/env/env.c +++ b/env/env.c @@ -52,7 +52,7 @@ static enum env_location env_get_default_location(void) return ENVL_UNKNOWN; } -struct env_driver *env_driver_lookup_default(void) +static struct env_driver *env_driver_lookup_default(void) { enum env_location loc = env_get_default_location(); struct env_driver *drv; @@ -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__, diff --git a/include/environment.h b/include/environment.h index d29f82cb5d6f..a2015c299aa9 100644 --- a/include/environment.h +++ b/include/environment.h @@ -293,13 +293,6 @@ int env_import_redund(const char *buf1, const char *buf2); #endif /** - * env_driver_lookup_default() - Look up the default environment driver - * - * @return pointer to driver, or NULL if none (which should not happen) - */ -struct env_driver *env_driver_lookup_default(void); - -/** * env_get_char() - Get a character from the early environment * * This reads from the pre-relocation environemnt