env: Move get/set_default_env() to env.h
[oweals/u-boot.git] / env / sf.c
index 4f92ae0568edbb9c04a9a771f8736224f29948e9..5531293e05697c8a6d29e45826641a10830f1bc9 100644 (file)
--- 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 @@ static int setup_flash_device(void)
                                     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 @@ static int setup_flash_device(void)
                        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 @@ static int env_sf_load(void)
        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 @@ static int env_sf_load(void)
 
        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 @@ static int env_sf_load(void)
        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;
        }