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/cmd/pxe.c b/cmd/pxe.c
index 357b969..c057907 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -33,15 +33,15 @@
 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 @@
 		}
 
 		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 @@
 
 	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 @@
 		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 @@
 	 *
 	 * 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 @@
 		} 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 @@
 				 * 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 @@
 	}
 
 	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 @@
 	}
 
 	if (argc < 6)
-		filename = getenv("bootfile");
+		filename = env_get("bootfile");
 	else {
 		filename = argv[5];
 		env_set("bootfile", filename);