From: Simon Glass Date: Thu, 3 Aug 2017 18:22:08 +0000 (-0600) Subject: env: Drop saveenv() in favour of env_save() X-Git-Url: http://git.dujemihanovic.xyz/login.html?a=commitdiff_plain;h=01510091de905c46620757b9027b2e55c4b3b313;p=u-boot.git env: Drop saveenv() in favour of env_save() 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 --- 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/intel/edison/edison.c b/board/intel/edison/edison.c index a1a7d4d7c8..80f9b544b0 100644 --- a/board/intel/edison/edison.c +++ b/board/intel/edison/edison.c @@ -5,6 +5,7 @@ */ #include #include +#include #include #include #include @@ -70,7 +71,7 @@ static void assign_serial(void) setenv("serial#", serial); #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) - saveenv(); + env_save(); #endif } @@ -88,7 +89,7 @@ static void assign_hardware_id(void) setenv("hardware_id", hardware_id); #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) - saveenv(); + env_save(); #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 85d95e5747..2b8b9611cf 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 c8fb277cde..030c179fba 100644 --- a/include/common.h +++ b/include/common.h @@ -336,7 +336,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 b4f93663da..a055e3fa89 100644 --- a/include/environment.h +++ b/include/environment.h @@ -325,6 +325,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_ */