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>
This commit is contained in:
Simon Glass
2020-10-03 09:25:22 -06:00
parent 08c3b88dd1
commit a652d9c73a
6 changed files with 37 additions and 49 deletions

View File

@@ -90,17 +90,10 @@ DECLARE_GLOBAL_DATA_PTR;
*
* @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;
return gd_of_root() != NULL;
}
#else
static inline bool of_live_active(void)
{
return false;
}
#endif
#define OF_BAD_ADDR ((u64)-1)