From patchwork Mon Jul 24 03:20:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 792642 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="vZs7ClvK"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xG6VB6wBsz9s1h for ; Mon, 24 Jul 2017 13:36:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id ACB4AC21DC0; Mon, 24 Jul 2017 03:30:58 +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_DNSWL_NONE, 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 C4802C21DFE; Mon, 24 Jul 2017 03:21:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D54C3C21C97; Mon, 24 Jul 2017 03:21:07 +0000 (UTC) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) by lists.denx.de (Postfix) with ESMTPS id AC21FC21DCF for ; Mon, 24 Jul 2017 03:20:55 +0000 (UTC) Received: by mail-oi0-f45.google.com with SMTP id e124so54379501oig.2 for ; Sun, 23 Jul 2017 20:20:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LnEdlNfFvVBWDYMjdQCGe+HoetZ6INwKbCkWfswe6Ds=; b=vZs7ClvKEzddgilZaCj8lNibUOjVQ15+UKOFKYfm4wxYUq6ozVMxtcPjCnY/n7o18a 0JuSBJb6b+DxObeJtL0KJw2vG0D337SI2uWttgBKOG5REVlgO6f1REgQ8unXuayE5SjL DLffxla3cpotXVt48RmCkuoNXYB1PgdYt592T7m+XXo610zDx3GCL3AkOLmFFSwhX9Js UZEtEmAHsyV6SJ6Pk0mY11XH3a90vugXDXBWVzca+jgTEffq1QJ3/pOblpv8MWBTcYRg +Q00b28D7Dg23DelYbdA9UNqWZc4beacvaMW5sxJIYTIFpTxj5/FTgY598cHI2m69F6C Tf3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LnEdlNfFvVBWDYMjdQCGe+HoetZ6INwKbCkWfswe6Ds=; b=ALSWbeGP5pedrtlo3MjiFlk6+h7vAAukuYXiyh1EAXWt5jjA2E1lKgkgWXAZpt+qeR C812hlMUIy+zp8bDOGm9DJZ76f64e/1ny2E9HYz7BqZ68v+XeOIzY1IJMQ5lzb95Mn7O oXy0X0nCOCEf7Khxm/b7chwrMQ+z03Ss6AE1UGwnAlATYhZVIln07gbjRkq5c0GQX8jT ObK6xs0i/WmkV6njrr61fPgkC0282teJrImxagYcYyDb8p3og7bVovoSbpOT+1m5PsVS TEAqD6w7eYmHPAepIm9zFel82e31JRM6caNwMVj/Zz/w3H1eAXoK1WDAwIApmz+o5xws qDdQ== X-Gm-Message-State: AIVw112dBnN0O3WyHCnMD/ceKeJjE2bhF4gcVb4pn/NJ5ygWRflvrqvY a13OFHuEOyv3HpQf X-Received: by 10.202.193.133 with SMTP id r127mr5646286oif.117.1500866454279; Sun, 23 Jul 2017 20:20:54 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:0:10f2:0:bd98:3ea1:ea41:e573]) by smtp.gmail.com with ESMTPSA id 71sm8733101oic.49.2017.07.23.20.20.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jul 2017 20:20:53 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 26A5A142283; Sun, 23 Jul 2017 21:20:52 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 23 Jul 2017 21:20:05 -0600 Message-Id: <20170724032009.43994-31-sjg@chromium.org> X-Mailer: git-send-email 2.14.0.rc0.284.gd933b75aa4-goog In-Reply-To: <20170724032009.43994-1-sjg@chromium.org> References: <20170724032009.43994-1-sjg@chromium.org> Cc: Tom Rini , Joe Hershberger , Andreas Fenkart Subject: [U-Boot] [PATCH v2 30/34] env: Drop saveenv() in favour of env_save() 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" Use the env_save() function directly now that there is only one implementation of saveenv(). Signed-off-by: Simon Glass Reviewed-by: Wolfgang Denk Reviewed-by: Tom Rini --- Changes in v2: None arch/arm/mach-omap2/boot-common.c | 3 ++- board/siemens/taurus/taurus.c | 5 +++-- board/toradex/apalis_imx6/apalis_imx6.c | 3 ++- cmd/nvedit.c | 2 +- drivers/bootcount/bootcount_env.c | 3 ++- env/env.c | 6 ------ include/common.h | 1 - include/environment.h | 7 +++++++ 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c index 700e6c2f79..2bcc8e9f97 100644 --- a/arch/arm/mach-omap2/boot-common.c +++ b/arch/arm/mach-omap2/boot-common.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -241,7 +242,7 @@ int fb_set_reboot_flag(void) { printf("Setting reboot to fastboot flag ...\n"); setenv("dofastboot", "1"); - saveenv(); + env_save(); return 0; } #endif diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c index 4aa8d64869..3b742ebc22 100644 --- a/board/siemens/taurus/taurus.c +++ b/board/siemens/taurus/taurus.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -405,7 +406,7 @@ static int upgrade_failure_fallback(void) setenv("bootargs", '\0'); setenv("upgrade_available", '\0'); setenv("boot_retries", '\0'); - saveenv(); + env_save(); return 0; } @@ -424,7 +425,7 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc, boot_retry++; sprintf(boot_buf, "%lx", boot_retry); setenv("boot_retries", boot_buf); - saveenv(); + env_save(); /* * Here the boot_retries count is checked, and if the diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c index 8e5613cb12..e41547bbee 100644 --- a/board/toradex/apalis_imx6/apalis_imx6.c +++ b/board/toradex/apalis_imx6/apalis_imx6.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -818,7 +819,7 @@ int board_late_init(void) setenv("fdt_file", FDT_FILE_V1_0); printf("patching fdt_file to " FDT_FILE_V1_0 "\n"); #ifndef CONFIG_ENV_IS_NOWHERE - saveenv(); + env_save(); #endif } } diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 75df997592..4431ef66d8 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -710,7 +710,7 @@ static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc, printf("Saving Environment to %s...\n", env->name); - return saveenv() ? 1 : 0; + return env_save() ? 1 : 0; } U_BOOT_CMD( diff --git a/drivers/bootcount/bootcount_env.c b/drivers/bootcount/bootcount_env.c index 2d6e8db126..7f22dd0748 100644 --- a/drivers/bootcount/bootcount_env.c +++ b/drivers/bootcount/bootcount_env.c @@ -6,6 +6,7 @@ */ #include +#include void bootcount_store(ulong a) { @@ -13,7 +14,7 @@ void bootcount_store(ulong a) if (upgrade_available) { setenv_ulong("bootcount", a); - saveenv(); + env_save(); } } diff --git a/env/env.c b/env/env.c index d2704f4861..9d232c1f34 100644 --- a/env/env.c +++ b/env/env.c @@ -149,9 +149,3 @@ int env_init(void) return 0; } - -int saveenv(void) -{ - return env_save(); -} - diff --git a/include/common.h b/include/common.h index 751665f8a4..f0fc02cd3b 100644 --- a/include/common.h +++ b/include/common.h @@ -335,7 +335,6 @@ ulong getenv_hex(const char *varname, ulong default_val); * Return -1 if variable does not exist (default to true) */ int getenv_yesno(const char *var); -int saveenv (void); int setenv (const char *, const char *); int setenv_ulong(const char *varname, ulong value); int setenv_hex(const char *varname, ulong value); diff --git a/include/environment.h b/include/environment.h index fa82f72baf..faf4d6adbb 100644 --- a/include/environment.h +++ b/include/environment.h @@ -320,6 +320,13 @@ int env_get_char(int index); */ int env_load(void); +/** + * env_save() - Save the environment to storage + * + * @return 0 if OK, -ve on error + */ +int env_save(void); + #endif /* DO_DEPS_ONLY */ #endif /* _ENVIRONMENT_H_ */