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>
diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c
index 0db7a3b..a25f501 100644
--- a/drivers/usb/gadget/designware_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -601,7 +601,7 @@
if ((ep != 0) && (udc_device->device_state < STATE_ADDRESSED))
return;
- tt = getenv("usbtty");
+ tt = env_get("usbtty");
if (!tt)
tt = "generic";
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index d010537..2cf5c8d 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -2384,12 +2384,12 @@
strlcpy(host_addr, CONFIG_USBNET_HOST_ADDR, sizeof(host_addr));
#endif
/* Check if the user overruled the MAC addresses */
- if (getenv("usbnet_devaddr"))
- strlcpy(dev_addr, getenv("usbnet_devaddr"),
+ if (env_get("usbnet_devaddr"))
+ strlcpy(dev_addr, env_get("usbnet_devaddr"),
sizeof(dev_addr));
- if (getenv("usbnet_hostaddr"))
- strlcpy(host_addr, getenv("usbnet_hostaddr"),
+ if (env_get("usbnet_hostaddr"))
+ strlcpy(host_addr, env_get("usbnet_hostaddr"),
sizeof(host_addr));
if (!is_eth_addr_valid(dev_addr)) {
@@ -2420,8 +2420,8 @@
gadget = dev->gadget;
usb_gadget_connect(gadget);
- if (getenv("cdc_connect_timeout"))
- timeout = simple_strtoul(getenv("cdc_connect_timeout"),
+ if (env_get("cdc_connect_timeout"))
+ timeout = simple_strtoul(env_get("cdc_connect_timeout"),
NULL, 10) * CONFIG_SYS_HZ;
ts = get_timer(0);
while (!dev->network_started) {
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index dfa4359..bc4be71 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -725,7 +725,7 @@
cdev->req->context = f_dfu;
- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 7cd6d24..d05b74b 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -212,7 +212,7 @@
f->hs_descriptors = fb_hs_function;
}
- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
g_dnl_set_serialnumber((char *)s);
@@ -426,7 +426,7 @@
sprintf(str_num, "0x%08x", CONFIG_FASTBOOT_BUF_SIZE);
strncat(response, str_num, chars_left);
} else if (!strcmp_l1("serialno", cmd)) {
- s = getenv("serial#");
+ s = env_get("serial#");
if (s)
strncat(response, s, chars_left);
else
@@ -441,7 +441,7 @@
}
sprintf(envstr, "fastboot.%s", cmd);
- s = getenv(envstr);
+ s = env_get(envstr);
if (s) {
strncat(response, s, chars_left);
} else {
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index b57c6cd..62c431b 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -225,7 +225,7 @@
"phy_type", &len);
#endif
else
- phy_type = getenv("usb_phy_type");
+ phy_type = env_get("usb_phy_type");
if (!phy_type) {
#ifdef CONFIG_SYS_FSL_USB_INTERNAL_UTMI_PHY