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>
diff --git a/include/dm/of.h b/include/dm/of.h
index 6bef73b..5cb6f44 100644
--- a/include/dm/of.h
+++ b/include/dm/of.h
@@ -90,17 +90,10 @@
*
* @returns true if livetree is active, false it not
*/
-#ifdef CONFIG_OF_LIVE
static inline bool of_live_active(void)
{
- return gd->of_root != NULL;
-}
-#else
-static inline bool of_live_active(void)
-{
- return false;
+ return gd_of_root() != NULL;
}
-#endif
#define OF_BAD_ADDR ((u64)-1)