Skip to content

Commit

Permalink
env: Rename setenv() to env_set()
Browse files Browse the repository at this point in the history
We are now using an env_ prefix for environment functions. Rename setenv()
for consistency. Also add function comments in common.h.

Suggested-by: Wolfgang Denk <[email protected]>
Signed-off-by: Simon Glass <[email protected]>
  • Loading branch information
sjg20 authored and trini committed Aug 16, 2017
1 parent 0151009 commit 382bee5
Show file tree
Hide file tree
Showing 156 changed files with 470 additions and 454 deletions.
2 changes: 1 addition & 1 deletion api/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static int API_env_set(va_list ap)
if ((value = (char *)va_arg(ap, uintptr_t)) == NULL)
return API_EINVAL;

setenv(name, value);
env_set(name, value);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv7/vf610/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ int arch_misc_init(void)

strcpy(soc, "vf");
strcat(soc, soc_type);
setenv("soc", soc);
env_set("soc", soc);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/lib/semihosting.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
/* Optionally save returned end to the environment */
if (argc == 4) {
sprintf(end_str, "0x%08lx", end_addr);
setenv(argv[3], end_str);
env_set(argv[3], end_str);
}
} else {
return CMD_RET_USAGE;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-imx/mx6/opos6ul.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int board_late_init(void)
/* In bootstrap don't use the env vars */
if (((reg & 0x3000000) >> 24) == 0x1) {
set_default_env(NULL);
setenv("preboot", "");
env_set("preboot", "");
}

return opos6ul_board_late_init();
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-imx/mx7/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ int arch_misc_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
if (is_mx7d())
setenv("soc", "imx7d");
env_set("soc", "imx7d");
else
setenv("soc", "imx7s");
env_set("soc", "imx7s");
#endif

return 0;
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/boot-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void arch_preboot_os(void)
int fb_set_reboot_flag(void)
{
printf("Setting reboot to fastboot flag ...\n");
setenv("dofastboot", "1");
env_set("dofastboot", "1");
env_save();
return 0;
}
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/mach-omap2/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static void omap_set_fastboot_cpu(void)
printf("Warning: fastboot.cpu: unknown CPU rev: %u\n", cpu_rev);
}

setenv("fastboot.cpu", cpu);
env_set("fastboot.cpu", cpu);
}

static void omap_set_fastboot_secure(void)
Expand All @@ -63,7 +63,7 @@ static void omap_set_fastboot_secure(void)
printf("Warning: fastboot.secure: unknown CPU sec: %u\n", dev);
}

setenv("fastboot.secure", secure);
env_set("fastboot.secure", secure);
}

static void omap_set_fastboot_board_rev(void)
Expand All @@ -74,7 +74,7 @@ static void omap_set_fastboot_board_rev(void)
if (board_rev == NULL)
printf("Warning: fastboot.board_rev: unknown board revision\n");

setenv("fastboot.board_rev", board_rev);
env_set("fastboot.board_rev", board_rev);
}

#ifdef CONFIG_FASTBOOT_FLASH_MMC_DEV
Expand Down Expand Up @@ -118,7 +118,7 @@ static void omap_set_fastboot_userdata_size(void)
sprintf(buf, "%u", sz_kb);
}

setenv("fastboot.userdata_size", buf);
env_set("fastboot.userdata_size", buf);
}
#else
static inline void omap_set_fastboot_userdata_size(void)
Expand Down Expand Up @@ -173,7 +173,7 @@ void omap_die_id_serial(void)
snprintf(serial_string, sizeof(serial_string),
"%08x%08x", die_id[0], die_id[3]);

setenv("serial#", serial_string);
env_set("serial#", serial_string);
}
}

Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-rockchip/rk3036-board.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ static void setup_boot_mode(void)
switch (boot_mode) {
case BOOT_FASTBOOT:
printf("enter fastboot!\n");
setenv("preboot", "setenv preboot; fastboot usb0");
env_set("preboot", "setenv preboot; fastboot usb0");
break;
case BOOT_UMS:
printf("enter UMS!\n");
setenv("preboot", "setenv preboot; ums mmc 0");
env_set("preboot", "setenv preboot; ums mmc 0");
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-rockchip/rk322x-board.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ static void setup_boot_mode(void)
switch (boot_mode) {
case BOOT_FASTBOOT:
printf("enter fastboot!\n");
setenv("preboot", "setenv preboot; fastboot usb0");
env_set("preboot", "setenv preboot; fastboot usb0");
break;
case BOOT_UMS:
printf("enter UMS!\n");
setenv("preboot", "setenv preboot; ums mmc 0");
env_set("preboot", "setenv preboot; ums mmc 0");
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-rockchip/rk3288-board.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ static void setup_boot_mode(void)
switch (boot_mode) {
case BOOT_FASTBOOT:
printf("enter fastboot!\n");
setenv("preboot", "setenv preboot; fastboot usb0");
env_set("preboot", "setenv preboot; fastboot usb0");
break;
case BOOT_UMS:
printf("enter UMS!\n");
setenv("preboot", "setenv preboot; if mmc dev 0;"
env_set("preboot", "setenv preboot; if mmc dev 0;"
"then ums mmc 0; else ums mmc 1;fi");
break;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-socfpga/misc_gen5.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,9 @@ int arch_misc_init(void)
{
const u32 bsel = readl(&sysmgr_regs->bootinfo) & 0x7;
const int fpga_id = socfpga_fpga_id(0);
setenv("bootmode", bsel_str[bsel].mode);
env_set("bootmode", bsel_str[bsel].mode);
if (fpga_id >= 0)
setenv("fpgatype", socfpga_fpga_model[fpga_id].var);
env_set("fpgatype", socfpga_fpga_model[fpga_id].var);
return socfpga_eth_reset();
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/mach-tegra/board2.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ int board_late_init(void)
#if defined(CONFIG_TEGRA_SUPPORT_NON_SECURE)
if (tegra_cpu_is_non_secure()) {
printf("CPU is in NS mode\n");
setenv("cpu_ns_mode", "1");
env_set("cpu_ns_mode", "1");
} else {
setenv("cpu_ns_mode", "");
env_set("cpu_ns_mode", "");
}
#endif
start_cpu_fan();
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-tegra/tegra186/nvtboot_board.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static int set_ethaddr_from_nvtboot(void)
return -ENOENT;
}

ret = setenv("ethaddr", (void *)prop);
ret = env_set("ethaddr", (void *)prop);
if (ret) {
printf("Failed to set ethaddr from nvtboot DTB: %d\n", ret);
return ret;
Expand Down
10 changes: 5 additions & 5 deletions arch/arm/mach-uniphier/board_late_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static int uniphier_set_fdt_file(void)

strncat(dtb_name, ".dtb", buf_len);

return setenv("fdt_file", dtb_name);
return env_set("fdt_file", dtb_name);
}

int board_late_init(void)
Expand All @@ -65,20 +65,20 @@ int board_late_init(void)
switch (uniphier_boot_device_raw()) {
case BOOT_DEVICE_MMC1:
printf("eMMC Boot");
setenv("bootmode", "emmcboot");
env_set("bootmode", "emmcboot");
break;
case BOOT_DEVICE_NAND:
printf("NAND Boot");
setenv("bootmode", "nandboot");
env_set("bootmode", "nandboot");
nand_denali_wp_disable();
break;
case BOOT_DEVICE_NOR:
printf("NOR Boot");
setenv("bootmode", "norboot");
env_set("bootmode", "norboot");
break;
case BOOT_DEVICE_USB:
printf("USB Boot");
setenv("bootmode", "usbboot");
env_set("bootmode", "usbboot");
break;
default:
printf("Unknown");
Expand Down
14 changes: 7 additions & 7 deletions board/Arcturus/ucp1020/cmd_arc.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int get_arc_info(void)
printf("\t<not found>\n");
} else {
printf("\t%s\n", smac[3]);
setenv("SERIAL", smac[3]);
env_set("SERIAL", smac[3]);
}
}

Expand All @@ -152,16 +152,16 @@ int get_arc_info(void)
char *ret = getenv("ethaddr");

if (strcmp(ret, __stringify(CONFIG_ETHADDR)) == 0) {
setenv("ethaddr", smac[2]);
env_set("ethaddr", smac[2]);
printf("\t%s (factory)\n", smac[2]);
} else {
printf("\t%s\n", ret);
}
}

if (strcmp(smac[1], "00:00:00:00:00:00") == 0) {
setenv("eth1addr", smac[2]);
setenv("eth2addr", smac[2]);
env_set("eth1addr", smac[2]);
env_set("eth2addr", smac[2]);
return 0;
}

Expand All @@ -172,15 +172,15 @@ int get_arc_info(void)
char *ret = getenv("eth1addr");

if (strcmp(ret, __stringify(CONFIG_ETH1ADDR)) == 0) {
setenv("eth1addr", smac[1]);
env_set("eth1addr", smac[1]);
printf("\t%s (factory)\n", smac[1]);
} else {
printf("\t%s\n", ret);
}
}

if (strcmp(smac[0], "00:00:00:00:00:00") == 0) {
setenv("eth2addr", smac[1]);
env_set("eth2addr", smac[1]);
return 0;
}

Expand All @@ -191,7 +191,7 @@ int get_arc_info(void)
char *ret = getenv("eth2addr");

if (strcmp(ret, __stringify(CONFIG_ETH2ADDR)) == 0) {
setenv("eth2addr", smac[0]);
env_set("eth2addr", smac[0]);
printf("\t%s (factory)\n", smac[0]);
} else {
printf("\t%s\n", ret);
Expand Down
6 changes: 3 additions & 3 deletions board/Arcturus/ucp1020/ucp1020.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ int last_stage_init(void)
strcat(newkernelargs, mmckargs);
strcat(newkernelargs, " ");
strcat(newkernelargs, &tmp[n]);
setenv("kernelargs", newkernelargs);
env_set("kernelargs", newkernelargs);
} else {
setenv("kernelargs", mmckargs);
env_set("kernelargs", mmckargs);
}
}
get_arc_info();
Expand All @@ -244,7 +244,7 @@ int last_stage_init(void)
strcat(newkernelargs, sval);
strcat(newkernelargs, " ");
strcat(newkernelargs, kval);
setenv("kernelargs", newkernelargs);
env_set("kernelargs", newkernelargs);
}
} else {
printf("Error reading kernelargs env variable!\n");
Expand Down
2 changes: 1 addition & 1 deletion board/BuR/brppt1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"switching to network-console ... ");
setenv("bootcmd", "run netconsole");
env_set("bootcmd", "run netconsole");
}
return 0;
}
Expand Down
16 changes: 8 additions & 8 deletions board/BuR/brxre1/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,15 +203,15 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"switching to network-console ... ");
setenv("bootcmd", "run netconsole");
env_set("bootcmd", "run netconsole");
cnt = 4;
break;
} else if (!gpio_get_value(ESC_KEY) &&
gpio_get_value(PUSH_KEY) && 1 == cnt) {
lcd_position_cursor(1, 8);
lcd_puts(
"starting u-boot script from USB ... ");
setenv("bootcmd", "run usbscript");
env_set("bootcmd", "run usbscript");
cnt = 4;
break;
} else if ((!gpio_get_value(ESC_KEY) &&
Expand All @@ -221,7 +221,7 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"starting script from network ... ");
setenv("bootcmd", "run netscript");
env_set("bootcmd", "run netscript");
cnt = 4;
break;
} else if (!gpio_get_value(ESC_KEY)) {
Expand All @@ -232,27 +232,27 @@ int board_late_init(void)
lcd_position_cursor(1, 8);
lcd_puts(
"starting vxworks from network ... ");
setenv("bootcmd", "run netboot");
env_set("bootcmd", "run netboot");
cnt = 4;
} else if (scratchreg == 0xCD) {
lcd_position_cursor(1, 8);
lcd_puts(
"starting script from network ... ");
setenv("bootcmd", "run netscript");
env_set("bootcmd", "run netscript");
cnt = 4;
} else if (scratchreg == 0xCE) {
lcd_position_cursor(1, 8);
lcd_puts(
"starting AR from eMMC ... ");
setenv("bootcmd", "run mmcboot");
env_set("bootcmd", "run mmcboot");
cnt = 4;
}

lcd_position_cursor(1, 8);
switch (cnt) {
case 0:
lcd_puts("entering BOOT-mode. ");
setenv("bootcmd", "run defaultAR");
env_set("bootcmd", "run defaultAR");
buf = 0x0000;
break;
case 1:
Expand Down Expand Up @@ -285,7 +285,7 @@ int board_late_init(void)
(u32)getenv_ulong("vx_memtop", 16, gd->fb_base-0x20),
(u32)getenv_ulong("vx_romfsbase", 16, 0),
(u32)getenv_ulong("vx_romfssize", 16, 0));
setenv("othbootargs", othbootargs);
env_set("othbootargs", othbootargs);
/*
* reset VBAR registers to its reset location, VxWorks 6.9.3.2 does
* expect that vectors are there, original u-boot moves them to _start
Expand Down
2 changes: 1 addition & 1 deletion board/BuR/common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int load_lcdtiming(struct am335x_lcdpanel *panel)
puts("no 'factory-settings / rotation' in dtb!\n");
}
snprintf(buf, sizeof(buf), "fbcon=rotate:%d", panel_info.vl_rot);
setenv("optargs_rot", buf);
env_set("optargs_rot", buf);
#else
pnltmp.hactive = getenv_ulong("ds1_hactive", 10, ~0UL);
pnltmp.vactive = getenv_ulong("ds1_vactive", 10, ~0UL);
Expand Down
2 changes: 1 addition & 1 deletion board/CZ.NIC/turris_omnia/turris_omnia.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static int set_regdomain(void)
puts("EEPROM regdomain read failed.\n");

printf("Regdomain set to %s\n", rd);
return setenv("regdomain", rd);
return env_set("regdomain", rd);
}
#endif

Expand Down
Loading

0 comments on commit 382bee5

Please sign in to comment.