aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2021-02-09 11:48:50 +0100
committerTom Rini <trini@konsulko.com>2021-04-16 17:32:34 -0400
commit1af031ac3e3e75ea1ae58da093db956a8c9bc144 (patch)
tree3f972a312974cb7a43b09c9bf580cf1705d418ec
parent5557eec01cbfb0e415775434f29542dffb1a4423 (diff)
downloadu-boot-1af031ac3e3e75ea1ae58da093db956a8c9bc144.zip
u-boot-1af031ac3e3e75ea1ae58da093db956a8c9bc144.tar.gz
u-boot-1af031ac3e3e75ea1ae58da093db956a8c9bc144.tar.bz2
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 82b2f4135719 ("env_internal.h: add alternative ENV_SAVE_PTR macro"). Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--env/ext4.c3
-rw-r--r--env/mmc.c6
-rw-r--r--include/env_internal.h1
3 files changed, 3 insertions, 7 deletions
diff --git a/env/ext4.c b/env/ext4.c
index ec643f2..9f65afb 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -188,6 +188,5 @@ U_BOOT_ENV_LOCATION(ext4) = {
ENV_NAME("EXT4")
.load = env_ext4_load,
.save = ENV_SAVE_PTR(env_ext4_save),
- .erase = CONFIG_IS_ENABLED(CMD_ERASEENV) ? env_ext4_erase :
- NULL,
+ .erase = ENV_ERASE_PTR(env_ext4_erase),
};
diff --git a/env/mmc.c b/env/mmc.c
index 9b226be..09e94f0 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -233,7 +233,6 @@ fini:
return ret;
}
-#if defined(CONFIG_CMD_ERASEENV)
static inline int erase_env(struct mmc *mmc, unsigned long size,
unsigned long offset)
{
@@ -279,7 +278,6 @@ static int env_mmc_erase(void)
return ret;
}
-#endif /* CONFIG_CMD_ERASEENV */
#endif /* CONFIG_CMD_SAVEENV && !CONFIG_SPL_BUILD */
static inline int read_env(struct mmc *mmc, unsigned long size,
@@ -394,8 +392,6 @@ U_BOOT_ENV_LOCATION(mmc) = {
.load = env_mmc_load,
#ifndef CONFIG_SPL_BUILD
.save = env_save_ptr(env_mmc_save),
-#if defined(CONFIG_CMD_ERASEENV)
- .erase = env_mmc_erase,
-#endif
+ .erase = ENV_ERASE_PTR(env_mmc_erase)
#endif
};
diff --git a/include/env_internal.h b/include/env_internal.h
index 708c833..b7bddcb 100644
--- a/include/env_internal.h
+++ b/include/env_internal.h
@@ -211,6 +211,7 @@ struct env_driver {
#endif
#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;