[PATCH v5 25/26] fdt: Drop remaining preprocessor macros in fdtdec_setup()

Simon Glass sjg at chromium.org
Tue Oct 26 02:23:43 CEST 2021


We only have two choices for obtaining the devicetree. Simplify the code
to make that clear.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 lib/fdtdec.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 0973cf0690b..067c27d0aa3 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -1621,13 +1621,13 @@ static void setup_multi_dtb_fit(void)
 int fdtdec_setup(void)
 {
 	int ret;
-#ifdef CONFIG_OF_EMBED
-	/* Get a pointer to the FDT */
-	gd->fdt_blob = dtb_dt_embedded();
-#elif defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
-	/* Allow the board to override the fdt address. */
-	gd->fdt_blob = board_fdt_blob_setup();
-#endif
+
+	/* The devicetree is typically appended to U-Boot */
+	if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD))
+		gd->fdt_blob = board_fdt_blob_setup();
+	else /* embed dtb in ELF file for testing / development */
+		gd->fdt_blob = dtb_dt_embedded();
+
 	if (!IS_ENABLED(CONFIG_SPL_BUILD)) {
 		/* Allow the early environment to override the fdt address */
 		gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,
-- 
2.33.0.1079.g6e70778dc9-goog



More information about the U-Boot mailing list