env: Rename setenv() to env_set()

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 <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/common/board_r.c b/common/board_r.c
index 985aa95..a4a7384 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -658,7 +658,7 @@
 	pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 # endif
 	sprintf(memsz, "%ldk", (long int) ((gd->ram_size / 1024) - pram));
-	setenv("mem", memsz);
+	env_set("mem", memsz);
 
 	return 0;
 }
diff --git a/common/bootm.c b/common/bootm.c
index b2c0912..f5ecc06 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -569,7 +569,7 @@
 		env_val = CONSOLE_ARG;
 	}
 
-	setenv("bootargs", env_val);
+	env_set("bootargs", env_val);
 	debug("after silent fix-up: %s\n", env_val);
 	free(buf);
 }
diff --git a/common/cli_hush.c b/common/cli_hush.c
index 00861e2..2802896 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -2265,7 +2265,7 @@
 			} else {
 #ifndef __U_BOOT__
 				if(cur->flg_export)
-					unsetenv(cur->name);
+					unenv_set(cur->name);
 #endif
 				free(cur->name);
 				free(cur->value);
diff --git a/common/console.c b/common/console.c
index ec4af3b..3f7ca2b 100644
--- a/common/console.c
+++ b/common/console.c
@@ -801,7 +801,7 @@
 #ifdef CONFIG_SYS_CONSOLE_ENV_OVERWRITE
 	/* set the environment variables (will overwrite previous env settings) */
 	for (i = 0; i < 3; i++) {
-		setenv(stdio_names[i], stdio_devices[i]->name);
+		env_set(stdio_names[i], stdio_devices[i]->name);
 	}
 #endif /* CONFIG_SYS_CONSOLE_ENV_OVERWRITE */
 
@@ -880,7 +880,7 @@
 
 	/* Setting environment variables */
 	for (i = 0; i < 3; i++) {
-		setenv(stdio_names[i], stdio_devices[i]->name);
+		env_set(stdio_names[i], stdio_devices[i]->name);
 	}
 
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
diff --git a/common/hash.c b/common/hash.c
index 771d8fa..fda636d 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -302,7 +302,7 @@
 			str_ptr += 2;
 		}
 		*str_ptr = '\0';
-		setenv(dest, str_output);
+		env_set(dest, str_output);
 	} else {
 		ulong addr;
 		void *buf;
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 4ae042e..85aaabb 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -243,7 +243,7 @@
 	const char *ret;
 	size_t len;
 
-	setenv("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
+	env_set("hwconfig", "key1:subkey1=value1,subkey2=value2;key2:value3;;;;"
 			   "key3;:,:=;key4", 1);
 
 	ret = hwconfig_arg("key1", &len);
@@ -274,7 +274,7 @@
 	assert(hwconfig_arg("key4", &len) == NULL);
 	assert(hwconfig_arg("bogus", &len) == NULL);
 
-	unsetenv("hwconfig");
+	unenv_set("hwconfig");
 
 	assert(hwconfig(NULL) == 0);
 	assert(hwconfig("") == 0);
diff --git a/common/image-android.c b/common/image-android.c
index c668407..018c759 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -90,7 +90,7 @@
 	if (*hdr->cmdline)
 		strcat(newbootargs, hdr->cmdline);
 
-	setenv("bootargs", newbootargs);
+	env_set("bootargs", newbootargs);
 
 	if (os_data) {
 		*os_data = (ulong)hdr;
diff --git a/common/main.c b/common/main.c
index 2116a9e..07fc31b 100644
--- a/common/main.c
+++ b/common/main.c
@@ -48,7 +48,7 @@
 	bootstage_mark_name(BOOTSTAGE_ID_MAIN_LOOP, "main_loop");
 
 #ifdef CONFIG_VERSION_VARIABLE
-	setenv("ver", version_string);  /* set version variable */
+	env_set("ver", version_string);  /* set version variable */
 #endif /* CONFIG_VERSION_VARIABLE */
 
 	cli_init();
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 5176857..3c887b3 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -279,7 +279,7 @@
 	  configuration. But some boards use this to support 'Falcon' boot
 	  on EXT2 and FAT, where SPL boots directly into Linux without
 	  starting U-Boot first. Enabling this option will make getenv()
-	  and setenv() available in SPL.
+	  and env_set() available in SPL.
 
 config SPL_SAVEENV
 	bool "Support save environment"
diff --git a/common/spl/spl_dfu.c b/common/spl/spl_dfu.c
index e8d0ba1..f5ec0fb 100644
--- a/common/spl/spl_dfu.c
+++ b/common/spl/spl_dfu.c
@@ -46,7 +46,7 @@
 		return -EINVAL;
 	}
 
-	ret = setenv("dfu_alt_info", str_env);
+	ret = env_set("dfu_alt_info", str_env);
 	if (ret) {
 		error("unable to set env variable \"dfu_alt_info\"!\n");
 		return -EINVAL;
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index 85fe508..8883109 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -33,14 +33,14 @@
 
 	env_init();
 	env_relocate();
-	setenv("autoload", "yes");
+	env_set("autoload", "yes");
 	rv = eth_initialize();
 	if (rv == 0) {
 		printf("No Ethernet devices found\n");
 		return -ENODEV;
 	}
 	if (bootdev->boot_device_name)
-		setenv("ethact", bootdev->boot_device_name);
+		env_set("ethact", bootdev->boot_device_name);
 	rv = net_loop(BOOTP);
 	if (rv < 0) {
 		printf("Problem booting with BOOTP\n");
diff --git a/common/update.c b/common/update.c
index 0767fcb..061a554 100644
--- a/common/update.c
+++ b/common/update.c
@@ -67,7 +67,7 @@
 	tftp_timeout_count_max = cnt_max;
 
 	/* we don't want to retry the connection if errors occur */
-	setenv("netretry", "no");
+	env_set("netretry", "no");
 
 	/* download the update file */
 	load_addr = addr;
@@ -83,7 +83,7 @@
 	tftp_timeout_ms = saved_timeout_msecs;
 	tftp_timeout_count_max = saved_timeout_count;
 
-	setenv("netretry", saved_netretry);
+	env_set("netretry", saved_netretry);
 	if (saved_netretry != NULL)
 		free(saved_netretry);