diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-generic/global_data.h | 13 | ||||
| -rw-r--r-- | include/dm/of.h | 9 |
2 files changed, 13 insertions, 9 deletions
diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 0157af1aa4..cadfc05dd7 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 * diff --git a/include/dm/of.h b/include/dm/of.h index 6bef73b441..5cb6f44a6c 100644 --- a/include/dm/of.h +++ b/include/dm/of.h @@ -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) |
