Skip to content
Snippets Groups Projects
Commit 1af031ac authored by Patrick Delaunay's avatar Patrick Delaunay Committed by Tom Rini
Browse files

env: add ENV_ERASE_PTR macro


Add ENV_ERASE_PTR macro to handle erase opts and remove the associated
ifdef.

This patch is a extension of previous commit 82b2f413 ("env_internal.h:
add alternative ENV_SAVE_PTR macro").

Signed-off-by: default avatarPatrick Delaunay <patrick.delaunay@foss.st.com>
parent 5557eec0
No related branches found
No related tags found
No related merge requests found
...@@ -188,6 +188,5 @@ U_BOOT_ENV_LOCATION(ext4) = { ...@@ -188,6 +188,5 @@ U_BOOT_ENV_LOCATION(ext4) = {
ENV_NAME("EXT4") ENV_NAME("EXT4")
.load = env_ext4_load, .load = env_ext4_load,
.save = ENV_SAVE_PTR(env_ext4_save), .save = ENV_SAVE_PTR(env_ext4_save),
.erase = CONFIG_IS_ENABLED(CMD_ERASEENV) ? env_ext4_erase : .erase = ENV_ERASE_PTR(env_ext4_erase),
NULL,
}; };
...@@ -233,7 +233,6 @@ fini: ...@@ -233,7 +233,6 @@ fini:
return ret; return ret;
} }
#if defined(CONFIG_CMD_ERASEENV)
static inline int erase_env(struct mmc *mmc, unsigned long size, static inline int erase_env(struct mmc *mmc, unsigned long size,
unsigned long offset) unsigned long offset)
{ {
...@@ -279,7 +278,6 @@ static int env_mmc_erase(void) ...@@ -279,7 +278,6 @@ static int env_mmc_erase(void)
return ret; return ret;
} }
#endif /* CONFIG_CMD_ERASEENV */
#endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */ #endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */
static inline int read_env(struct mmc *mmc, unsigned long size, static inline int read_env(struct mmc *mmc, unsigned long size,
...@@ -394,8 +392,6 @@ U_BOOT_ENV_LOCATION(mmc) = { ...@@ -394,8 +392,6 @@ U_BOOT_ENV_LOCATION(mmc) = {
.load = env_mmc_load, .load = env_mmc_load,
#ifndef CONFIG_SPL_BUILD #ifndef CONFIG_SPL_BUILD
.save = env_save_ptr(env_mmc_save), .save = env_save_ptr(env_mmc_save),
#if defined(CONFIG_CMD_ERASEENV) .erase = ENV_ERASE_PTR(env_mmc_erase)
.erase = env_mmc_erase,
#endif
#endif #endif
}; };
...@@ -211,6 +211,7 @@ struct env_driver { ...@@ -211,6 +211,7 @@ struct env_driver {
#endif #endif
#define ENV_SAVE_PTR(x) (CONFIG_IS_ENABLED(SAVEENV) ? (x) : NULL) #define ENV_SAVE_PTR(x) (CONFIG_IS_ENABLED(SAVEENV) ? (x) : NULL)
#define ENV_ERASE_PTR(x) (CONFIG_IS_ENABLED(CMD_ERASEENV) ? (x) : NULL)
extern struct hsearch_data env_htab; extern struct hsearch_data env_htab;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment