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 <sjg@chromium.org>
Reviewed-by: Wolfgang Denk <wd@denx.de>
Reviewed-by: Tom Rini <trini@konsulko.com>
master
Simon Glass 7 years ago committed by Tom Rini
parent 310fb14b26
commit 01510091de
  1. 3
      arch/arm/mach-omap2/boot-common.c
  2. 5
      board/intel/edison/edison.c
  3. 5
      board/siemens/taurus/taurus.c
  4. 3
      board/toradex/apalis_imx6/apalis_imx6.c
  5. 2
      cmd/nvedit.c
  6. 3
      drivers/bootcount/bootcount_env.c
  7. 6
      env/env.c
  8. 1
      include/common.h
  9. 7
      include/environment.h

@ -10,6 +10,7 @@
#include <common.h> #include <common.h>
#include <ahci.h> #include <ahci.h>
#include <environment.h>
#include <spl.h> #include <spl.h>
#include <asm/omap_common.h> #include <asm/omap_common.h>
#include <asm/arch/omap.h> #include <asm/arch/omap.h>
@ -241,7 +242,7 @@ int fb_set_reboot_flag(void)
{ {
printf("Setting reboot to fastboot flag ...\n"); printf("Setting reboot to fastboot flag ...\n");
setenv("dofastboot", "1"); setenv("dofastboot", "1");
saveenv(); env_save();
return 0; return 0;
} }
#endif #endif

@ -5,6 +5,7 @@
*/ */
#include <common.h> #include <common.h>
#include <dwc3-uboot.h> #include <dwc3-uboot.h>
#include <environment.h>
#include <mmc.h> #include <mmc.h>
#include <u-boot/md5.h> #include <u-boot/md5.h>
#include <usb.h> #include <usb.h>
@ -70,7 +71,7 @@ static void assign_serial(void)
setenv("serial#", serial); setenv("serial#", serial);
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
saveenv(); env_save();
#endif #endif
} }
@ -88,7 +89,7 @@ static void assign_hardware_id(void)
setenv("hardware_id", hardware_id); setenv("hardware_id", hardware_id);
#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE) #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
saveenv(); env_save();
#endif #endif
} }

@ -15,6 +15,7 @@
#include <command.h> #include <command.h>
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <environment.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/arch/at91sam9260_matrix.h> #include <asm/arch/at91sam9260_matrix.h>
#include <asm/arch/at91sam9_smc.h> #include <asm/arch/at91sam9_smc.h>
@ -405,7 +406,7 @@ static int upgrade_failure_fallback(void)
setenv("bootargs", '\0'); setenv("bootargs", '\0');
setenv("upgrade_available", '\0'); setenv("upgrade_available", '\0');
setenv("boot_retries", '\0'); setenv("boot_retries", '\0');
saveenv(); env_save();
return 0; return 0;
} }
@ -424,7 +425,7 @@ static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc,
boot_retry++; boot_retry++;
sprintf(boot_buf, "%lx", boot_retry); sprintf(boot_buf, "%lx", boot_retry);
setenv("boot_retries", boot_buf); setenv("boot_retries", boot_buf);
saveenv(); env_save();
/* /*
* Here the boot_retries count is checked, and if the * Here the boot_retries count is checked, and if the

@ -9,6 +9,7 @@
#include <common.h> #include <common.h>
#include <dm.h> #include <dm.h>
#include <environment.h>
#include <asm/arch/clock.h> #include <asm/arch/clock.h>
#include <asm/arch/crm_regs.h> #include <asm/arch/crm_regs.h>
#include <asm/arch/mxc_hdmi.h> #include <asm/arch/mxc_hdmi.h>
@ -818,7 +819,7 @@ int board_late_init(void)
setenv("fdt_file", FDT_FILE_V1_0); setenv("fdt_file", FDT_FILE_V1_0);
printf("patching fdt_file to " FDT_FILE_V1_0 "\n"); printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
#ifndef CONFIG_ENV_IS_NOWHERE #ifndef CONFIG_ENV_IS_NOWHERE
saveenv(); env_save();
#endif #endif
} }
} }

@ -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); printf("Saving Environment to %s...\n", env->name);
return saveenv() ? 1 : 0; return env_save() ? 1 : 0;
} }
U_BOOT_CMD( U_BOOT_CMD(

@ -6,6 +6,7 @@
*/ */
#include <common.h> #include <common.h>
#include <environment.h>
void bootcount_store(ulong a) void bootcount_store(ulong a)
{ {
@ -13,7 +14,7 @@ void bootcount_store(ulong a)
if (upgrade_available) { if (upgrade_available) {
setenv_ulong("bootcount", a); setenv_ulong("bootcount", a);
saveenv(); env_save();
} }
} }

6
env/env.c vendored

@ -149,9 +149,3 @@ int env_init(void)
return 0; return 0;
} }
int saveenv(void)
{
return env_save();
}

@ -336,7 +336,6 @@ ulong getenv_hex(const char *varname, ulong default_val);
* Return -1 if variable does not exist (default to true) * Return -1 if variable does not exist (default to true)
*/ */
int getenv_yesno(const char *var); int getenv_yesno(const char *var);
int saveenv (void);
int setenv (const char *, const char *); int setenv (const char *, const char *);
int setenv_ulong(const char *varname, ulong value); int setenv_ulong(const char *varname, ulong value);
int setenv_hex(const char *varname, ulong value); int setenv_hex(const char *varname, ulong value);

@ -325,6 +325,13 @@ int env_get_char(int index);
*/ */
int env_load(void); 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 /* DO_DEPS_ONLY */
#endif /* _ENVIRONMENT_H_ */ #endif /* _ENVIRONMENT_H_ */

Loading…
Cancel
Save