summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2020-02-19 09:47:40 +0000
committerTom Rini <trini@konsulko.com>2020-04-24 10:10:00 -0400
commit82b2f41357199c9fd06da80f8dd21e0576d08efe (patch)
tree5d962977aa083cf211c57c06516dbfbaf0bfd118 /include
parent1d0adee45cc2d3257c926d6022bf1922805b928e (diff)
downloadu-boot-82b2f41357199c9fd06da80f8dd21e0576d08efe.tar.gz
u-boot-82b2f41357199c9fd06da80f8dd21e0576d08efe.tar.bz2
u-boot-82b2f41357199c9fd06da80f8dd21e0576d08efe.zip
env_internal.h: add alternative ENV_SAVE_PTR macro
The current definition of the env_save_ptr does not take SPL_SAVEENV into account. Moreover, the way it is implemented means that drivers need to guard the definitions of their _save methods with ifdefs to avoid "defined but unused" warnings in case CMD_SAVEENV=n. The ifdeffery can be avoided by using a "something ? x : NULL" construction instead and still have the compiler elide the _save method when it is not referenced. Unfortunately we can't just switch the existing env_save_ptr macro, since that would give a lot of build errors unless all the ifdeffery is removed at the same time. Conversely, removing that ifdeffery first would merely lead to the "defined but unused" warnings temporarily, but for some storage drivers it requires a bit more work than just removing their private CMD_SAVEENV logic. So introduce an alternative to env_save_ptr, which for lack of a better name is simply uppercased, allowing one to update storage drivers piecemeal to both reduce their ifdeffery and honour CONFIG_SPL_SAVEENV. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Diffstat (limited to 'include')
-rw-r--r--include/env_internal.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/env_internal.h b/include/env_internal.h
index 90a4df8a72..e89fbdb1b7 100644
--- a/include/env_internal.h
+++ b/include/env_internal.h
@@ -207,6 +207,8 @@ struct env_driver {
#define env_save_ptr(x) NULL
#endif
+#define ENV_SAVE_PTR(x) (CONFIG_IS_ENABLED(SAVEENV) ? (x) : NULL)
+
extern struct hsearch_data env_htab;
#endif /* DO_DEPS_ONLY */