Commit 01510091de905c46620757b9027b2e55c4b3b313

Authored by Simon Glass
Committed by Tom Rini
1 parent 310fb14b26

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>

Showing 9 changed files with 20 additions and 15 deletions Side-by-side Diff

arch/arm/mach-omap2/boot-common.c
... ... @@ -10,6 +10,7 @@
10 10  
11 11 #include <common.h>
12 12 #include <ahci.h>
  13 +#include <environment.h>
13 14 #include <spl.h>
14 15 #include <asm/omap_common.h>
15 16 #include <asm/arch/omap.h>
... ... @@ -241,7 +242,7 @@
241 242 {
242 243 printf("Setting reboot to fastboot flag ...\n");
243 244 setenv("dofastboot", "1");
244   - saveenv();
  245 + env_save();
245 246 return 0;
246 247 }
247 248 #endif
board/intel/edison/edison.c
... ... @@ -5,6 +5,7 @@
5 5 */
6 6 #include <common.h>
7 7 #include <dwc3-uboot.h>
  8 +#include <environment.h>
8 9 #include <mmc.h>
9 10 #include <u-boot/md5.h>
10 11 #include <usb.h>
... ... @@ -70,7 +71,7 @@
70 71 setenv("serial#", serial);
71 72  
72 73 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
73   - saveenv();
  74 + env_save();
74 75 #endif
75 76 }
76 77  
... ... @@ -88,7 +89,7 @@
88 89 setenv("hardware_id", hardware_id);
89 90  
90 91 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
91   - saveenv();
  92 + env_save();
92 93 #endif
93 94 }
94 95  
board/siemens/taurus/taurus.c
... ... @@ -15,6 +15,7 @@
15 15 #include <command.h>
16 16 #include <common.h>
17 17 #include <dm.h>
  18 +#include <environment.h>
18 19 #include <asm/io.h>
19 20 #include <asm/arch/at91sam9260_matrix.h>
20 21 #include <asm/arch/at91sam9_smc.h>
... ... @@ -405,7 +406,7 @@
405 406 setenv("bootargs", '\0');
406 407 setenv("upgrade_available", '\0');
407 408 setenv("boot_retries", '\0');
408   - saveenv();
  409 + env_save();
409 410  
410 411 return 0;
411 412 }
... ... @@ -424,7 +425,7 @@
424 425 boot_retry++;
425 426 sprintf(boot_buf, "%lx", boot_retry);
426 427 setenv("boot_retries", boot_buf);
427   - saveenv();
  428 + env_save();
428 429  
429 430 /*
430 431 * Here the boot_retries count is checked, and if the
board/toradex/apalis_imx6/apalis_imx6.c
... ... @@ -9,6 +9,7 @@
9 9  
10 10 #include <common.h>
11 11 #include <dm.h>
  12 +#include <environment.h>
12 13 #include <asm/arch/clock.h>
13 14 #include <asm/arch/crm_regs.h>
14 15 #include <asm/arch/mxc_hdmi.h>
... ... @@ -818,7 +819,7 @@
818 819 setenv("fdt_file", FDT_FILE_V1_0);
819 820 printf("patching fdt_file to " FDT_FILE_V1_0 "\n");
820 821 #ifndef CONFIG_ENV_IS_NOWHERE
821   - saveenv();
  822 + env_save();
822 823 #endif
823 824 }
824 825 }
... ... @@ -710,7 +710,7 @@
710 710  
711 711 printf("Saving Environment to %s...\n", env->name);
712 712  
713   - return saveenv() ? 1 : 0;
  713 + return env_save() ? 1 : 0;
714 714 }
715 715  
716 716 U_BOOT_CMD(
drivers/bootcount/bootcount_env.c
... ... @@ -6,6 +6,7 @@
6 6 */
7 7  
8 8 #include <common.h>
  9 +#include <environment.h>
9 10  
10 11 void bootcount_store(ulong a)
11 12 {
... ... @@ -13,7 +14,7 @@
13 14  
14 15 if (upgrade_available) {
15 16 setenv_ulong("bootcount", a);
16   - saveenv();
  17 + env_save();
17 18 }
18 19 }
19 20  
... ... @@ -149,9 +149,4 @@
149 149  
150 150 return 0;
151 151 }
152   -
153   -int saveenv(void)
154   -{
155   - return env_save();
156   -}
... ... @@ -336,7 +336,6 @@
336 336 * Return -1 if variable does not exist (default to true)
337 337 */
338 338 int getenv_yesno(const char *var);
339   -int saveenv (void);
340 339 int setenv (const char *, const char *);
341 340 int setenv_ulong(const char *varname, ulong value);
342 341 int setenv_hex(const char *varname, ulong value);
include/environment.h
... ... @@ -325,6 +325,13 @@
325 325 */
326 326 int env_load(void);
327 327  
  328 +/**
  329 + * env_save() - Save the environment to storage
  330 + *
  331 + * @return 0 if OK, -ve on error
  332 + */
  333 +int env_save(void);
  334 +
328 335 #endif /* DO_DEPS_ONLY */
329 336  
330 337 #endif /* _ENVIRONMENT_H_ */