1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 16:52:14 +02:00

env: Rename getenv/_f() to env_get()

We are now using an env_ prefix for environment functions. Rename these
two functions for consistency. Also add function comments in common.h.

Quite a few places use getenv() in a condition context, provoking a
warning from checkpatch. These are fixed up in this patch also.

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2017-08-03 12:22:12 -06:00
committed by Tom Rini
parent fd1e959e91
commit 00caae6d47
213 changed files with 531 additions and 502 deletions

View File

@@ -33,15 +33,15 @@ const char *pxe_default_paths[] = {
static bool is_pxe;
/*
* Like getenv, but prints an error if envvar isn't defined in the
* environment. It always returns what getenv does, so it can be used in
* place of getenv without changing error handling otherwise.
* Like env_get, but prints an error if envvar isn't defined in the
* environment. It always returns what env_get does, so it can be used in
* place of env_get without changing error handling otherwise.
*/
static char *from_env(const char *envvar)
{
char *ret;
ret = getenv(envvar);
ret = env_get(envvar);
if (!ret)
printf("missing environment variable: %s\n", envvar);
@@ -649,9 +649,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
}
bootm_argv[2] = initrd_str;
strcpy(bootm_argv[2], getenv("ramdisk_addr_r"));
strcpy(bootm_argv[2], env_get("ramdisk_addr_r"));
strcat(bootm_argv[2], ":");
strcat(bootm_argv[2], getenv("filesize"));
strcat(bootm_argv[2], env_get("filesize"));
}
if (get_relfile_envaddr(cmdtp, label->kernel, "kernel_addr_r") < 0) {
@@ -662,8 +662,8 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
if (label->ipappend & 0x1) {
sprintf(ip_str, " ip=%s:%s:%s:%s",
getenv("ipaddr"), getenv("serverip"),
getenv("gatewayip"), getenv("netmask"));
env_get("ipaddr"), env_get("serverip"),
env_get("gatewayip"), env_get("netmask"));
}
#ifdef CONFIG_CMD_NET
@@ -699,7 +699,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
printf("append: %s\n", finalbootargs);
}
bootm_argv[1] = getenv("kernel_addr_r");
bootm_argv[1] = env_get("kernel_addr_r");
/*
* fdt usage is optional:
@@ -714,7 +714,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
*
* Scenario 3: fdt blob is not available.
*/
bootm_argv[3] = getenv("fdt_addr_r");
bootm_argv[3] = env_get("fdt_addr_r");
/* if fdt label is defined then get fdt from server */
if (bootm_argv[3]) {
@@ -726,7 +726,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
} else if (label->fdtdir) {
char *f1, *f2, *f3, *f4, *slash;
f1 = getenv("fdtfile");
f1 = env_get("fdtfile");
if (f1) {
f2 = "";
f3 = "";
@@ -739,9 +739,9 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
* or the boot scripts should set $fdtfile
* before invoking "pxe" or "sysboot".
*/
f1 = getenv("soc");
f1 = env_get("soc");
f2 = "-";
f3 = getenv("board");
f3 = env_get("board");
f4 = ".dtb";
}
@@ -781,7 +781,7 @@ static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
}
if (!bootm_argv[3])
bootm_argv[3] = getenv("fdt_addr");
bootm_argv[3] = env_get("fdt_addr");
if (bootm_argv[3]) {
if (!bootm_argv[2])
@@ -1671,7 +1671,7 @@ static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
if (argc < 6)
filename = getenv("bootfile");
filename = env_get("bootfile");
else {
filename = argv[5];
env_set("bootfile", filename);