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/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index 46404b4..e9865b4 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -1160,7 +1160,7 @@
 	char arg[10];
 	size_t len;
 	int i;
-	int quiet = simple_strtol(getenv("quiet"), NULL, 10);
+	int quiet = simple_strtol(env_get("quiet"), NULL, 10);
 
 	if (board >= GW_UNKNOWN)
 		return;
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 61298ab..4ddc7e1 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -298,11 +298,11 @@
 #endif
 
 	/* default to the first detected enet dev */
-	if (!getenv("ethprime")) {
+	if (!env_get("ethprime")) {
 		struct eth_device *dev = eth_get_dev_by_index(0);
 		if (dev) {
 			env_set("ethprime", dev->name);
-			printf("set ethprime to %s\n", getenv("ethprime"));
+			printf("set ethprime to %s\n", env_get("ethprime"));
 		}
 	}
 
@@ -579,7 +579,7 @@
  */
 void get_board_serial(struct tag_serialnr *serialnr)
 {
-	char *serial = getenv("serial#");
+	char *serial = env_get("serial#");
 
 	if (serial) {
 		serialnr->high = 0;
@@ -658,7 +658,7 @@
 	int quiet; /* Quiet or minimal output mode */
 
 	quiet = 0;
-	p = getenv("quiet");
+	p = env_get("quiet");
 	if (p)
 		quiet = simple_strtol(p, NULL, 10);
 	else
@@ -746,7 +746,7 @@
 		for (i = 0; i < (sizeof(str)-1) && info->model[i]; i++)
 			str[i] = tolower(info->model[i]);
 		env_set("model", str);
-		if (!getenv("fdt_file")) {
+		if (!env_get("fdt_file")) {
 			sprintf(fdt, "%s-%s.dtb", cputype, str);
 			env_set("fdt_file", fdt);
 		}
@@ -770,11 +770,11 @@
 
 		/* initialize env from EEPROM */
 		if (test_bit(EECONFIG_ETH0, info->config) &&
-		    !getenv("ethaddr")) {
+		    !env_get("ethaddr")) {
 			eth_env_set_enetaddr("ethaddr", info->mac0);
 		}
 		if (test_bit(EECONFIG_ETH1, info->config) &&
-		    !getenv("eth1addr")) {
+		    !env_get("eth1addr")) {
 			eth_env_set_enetaddr("eth1addr", info->mac1);
 		}
 
@@ -788,7 +788,7 @@
 	}
 
 	/* Set a non-initialized hwconfig based on board configuration */
-	if (!strcmp(getenv("hwconfig"), "_UNKNOWN_")) {
+	if (!strcmp(env_get("hwconfig"), "_UNKNOWN_")) {
 		buf[0] = 0;
 		if (gpio_cfg[board_type].rs232_en)
 			strcat(buf, "rs232;");
@@ -1035,7 +1035,7 @@
 	int j;
 
 	sprintf(mac, "eth1addr");
-	tmp = getenv(mac);
+	tmp = env_get(mac);
 	if (tmp) {
 		for (j = 0; j < 6; j++) {
 			mac_addr[j] = tmp ?
@@ -1118,8 +1118,8 @@
 		{ "sst,w25q256",          MTD_DEV_TYPE_NOR, },  /* SPI flash */
 		{ "fsl,imx6q-gpmi-nand",  MTD_DEV_TYPE_NAND, }, /* NAND flash */
 	};
-	const char *model = getenv("model");
-	const char *display = getenv("display");
+	const char *model = env_get("model");
+	const char *display = env_get("display");
 	int i;
 	char rev = 0;
 
@@ -1131,7 +1131,7 @@
 		}
 	}
 
-	if (getenv("fdt_noauto")) {
+	if (env_get("fdt_noauto")) {
 		puts("   Skiping ft_board_setup (fdt_noauto defined)\n");
 		return 0;
 	}
@@ -1152,15 +1152,15 @@
 	printf("   Adjusting FDT per EEPROM for %s...\n", model);
 
 	/* board serial number */
-	fdt_setprop(blob, 0, "system-serial", getenv("serial#"),
-		    strlen(getenv("serial#")) + 1);
+	fdt_setprop(blob, 0, "system-serial", env_get("serial#"),
+		    strlen(env_get("serial#")) + 1);
 
 	/* board (model contains model from device-tree) */
 	fdt_setprop(blob, 0, "board", info->model,
 		    strlen((const char *)info->model) + 1);
 
 	/* set desired digital video capture format */
-	ft_sethdmiinfmt(blob, getenv("hdmiinfmt"));
+	ft_sethdmiinfmt(blob, env_get("hdmiinfmt"));
 
 	/*
 	 * Board model specific fixups
@@ -1315,7 +1315,7 @@
 	}
 
 #if defined(CONFIG_CMD_PCI)
-	if (!getenv("nopcifixup"))
+	if (!env_get("nopcifixup"))
 		ft_board_pci_fixup(blob, bd);
 #endif
 
@@ -1324,7 +1324,7 @@
 	 *  remove nodes by alias path if EEPROM config tells us the
 	 *  peripheral is not loaded on the board.
 	 */
-	if (getenv("fdt_noconfig")) {
+	if (env_get("fdt_noconfig")) {
 		puts("   Skiping periperhal config (fdt_noconfig defined)\n");
 		return 0;
 	}
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c
index baa8480..feea228 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -691,7 +691,7 @@
 #ifdef CONFIG_SPL_ENV_SUPPORT
 	env_init();
 	env_load();
-	debug("boot_os=%s\n", getenv("boot_os"));
+	debug("boot_os=%s\n", env_get("boot_os"));
 	if (getenv_yesno("boot_os") == 1)
 		ret = 0;
 #else