]> git.sur5r.net Git - u-boot/blobdiff - env/ext4.c
Kconfig: Add EEPROM options to Kconfig when I2C_EEPROM is set
[u-boot] / env / ext4.c
index c6a84925d99186028ab54237606c063d9bf19e3a..65202213d3a80328f1117e5153c6178cc957ca8e 100644 (file)
 #include <ext4fs.h>
 #include <mmc.h>
 
-char *env_name_spec = "EXT4";
-
-env_t *env_ptr;
-
 DECLARE_GLOBAL_DATA_PTR;
 
-int env_init(void)
-{
-       /* use default */
-       gd->env_addr = (ulong)&default_environment[0];
-       gd->env_valid = ENV_VALID;
-
-       return 0;
-}
-
 #ifdef CONFIG_CMD_SAVEENV
-int saveenv(void)
+static int env_ext4_save(void)
 {
        env_t   env_new;
        struct blk_desc *dev_desc = NULL;
@@ -88,7 +75,7 @@ int saveenv(void)
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
-void env_relocate_spec(void)
+static int env_ext4_load(void)
 {
        ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
        struct blk_desc *dev_desc = NULL;
@@ -122,16 +109,17 @@ void env_relocate_spec(void)
        }
 
        env_import(buf, 1);
-       return;
+       return 0;
 
 err_env_relocate:
        set_default_env(NULL);
+
+       return -EIO;
 }
 
 U_BOOT_ENV_LOCATION(ext4) = {
        .location       = ENVL_EXT4,
-       .get_char       = env_get_char_spec,
-       .load           = env_relocate_spec,
-       .save           = env_save_ptr(saveenv),
-       .init           = env_init,
+       ENV_NAME("EXT4")
+       .load           = env_ext4_load,
+       .save           = env_save_ptr(env_ext4_save),
 };