aboutsummaryrefslogtreecommitdiff
path: root/include/asm-generic
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-10-03 09:25:22 -0600
committerSimon Glass <sjg@chromium.org>2020-10-29 14:42:17 -0600
commita652d9c73a6eea1fdfb901c66178a4d804fac95d (patch)
tree85eaeea9428ceb50ce9579f87edf49e442447a22 /include/asm-generic
parent08c3b88dd145d3f7f06e7ad8458905bde7a286ef (diff)
downloadu-boot-a652d9c73a6eea1fdfb901c66178a4d804fac95d.zip
u-boot-a652d9c73a6eea1fdfb901c66178a4d804fac95d.tar.gz
u-boot-a652d9c73a6eea1fdfb901c66178a4d804fac95d.tar.bz2
dm: Avoid using #ifdef for CONFIG_OF_LIVE
At present this option results in a number of #ifdefs due to the presence or absence of the global_data of_root member. Add a few macros to global_data.h to work around this. Update the code accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/global_data.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h
index 0157af1..cadfc05 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -211,7 +211,7 @@ struct global_data {
* @fdt_size: space reserved for relocated device space
*/
unsigned long fdt_size;
-#ifdef CONFIG_OF_LIVE
+#if CONFIG_IS_ENABLED(OF_LIVE)
/**
* @of_root: root node of the live tree
*/
@@ -427,6 +427,17 @@ struct global_data {
#define gd_board_type() 0
#endif
+/* These macros help avoid #ifdefs in the code */
+#if CONFIG_IS_ENABLED(OF_LIVE)
+#define gd_of_root() gd->of_root
+#define gd_of_root_ptr() &gd->of_root
+#define gd_set_of_root(_root) gd->of_root = (_root)
+#else
+#define gd_of_root() NULL
+#define gd_of_root_ptr() NULL
+#define gd_set_of_root(_root)
+#endif
+
/**
* enum gd_flags - global data flags
*