env: Move get/set_default_env() to env.h
Move these functions to the new header file and rename set_default_env()
to env_set_default() so that it has a consistent env_ prefix.
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/env/sf.c b/env/sf.c
index 4f92ae0..5531293 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -10,6 +10,7 @@
*/
#include <common.h>
#include <dm.h>
+#include <env.h>
#include <environment.h>
#include <malloc.h>
#include <spi.h>
@@ -48,7 +49,7 @@
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE,
&new);
if (ret) {
- set_default_env("spi_flash_probe_bus_cs() failed", 0);
+ env_set_default("spi_flash_probe_bus_cs() failed", 0);
return ret;
}
@@ -60,7 +61,7 @@
CONFIG_ENV_SPI_CS,
CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
- set_default_env("spi_flash_probe() failed", 0);
+ env_set_default("spi_flash_probe() failed", 0);
return -EIO;
}
}
@@ -161,7 +162,7 @@
tmp_env2 = (env_t *)memalign(ARCH_DMA_MINALIGN,
CONFIG_ENV_SIZE);
if (!tmp_env1 || !tmp_env2) {
- set_default_env("malloc() failed", 0);
+ env_set_default("malloc() failed", 0);
ret = -EIO;
goto out;
}
@@ -256,7 +257,7 @@
buf = (char *)memalign(ARCH_DMA_MINALIGN, CONFIG_ENV_SIZE);
if (!buf) {
- set_default_env("malloc() failed", 0);
+ env_set_default("malloc() failed", 0);
return -EIO;
}
@@ -267,7 +268,7 @@
ret = spi_flash_read(env_flash,
CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE, buf);
if (ret) {
- set_default_env("spi_flash_read() failed", 0);
+ env_set_default("spi_flash_read() failed", 0);
goto err_read;
}