]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fdt: Drop CONFIG_SPL_BUILD check in fdtdec_setup()
authorSimon Glass <sjg@chromium.org>
Fri, 17 Dec 2021 03:59:26 +0000 (20:59 -0700)
committerTom Rini <trini@konsulko.com>
Thu, 23 Dec 2021 15:24:39 +0000 (10:24 -0500)
Move this to the header file to clean up the C code.

Signed-off-by: Simon Glass <sjg@chromium.org>
include/fdtdec.h
lib/fdtdec.c

index 6c7ab887b207b84925f6052f16798d1429eda87e..68786111a44a8ec211959dcba2c3e07bdbafd969 100644 (file)
@@ -111,6 +111,20 @@ struct fdt_pci_addr {
 extern u8 __dtb_dt_begin[];    /* embedded device tree blob */
 extern u8 __dtb_dt_spl_begin[];        /* embedded device tree blob for SPL/TPL */
 
+/* Get a pointer to the embedded devicetree, if there is one, else NULL */
+static inline u8 *dtb_dt_embedded(void)
+{
+#ifdef CONFIG_OF_EMBED
+# ifdef CONFIG_SPL_BUILD
+       return __dtb_dt_spl_begin;
+# else
+       return __dtb_dt_begin;
+# endif
+#else
+       return NULL;
+#endif
+}
+
 /**
  * Compute the size of a resource.
  *
index 4967ab87075d0e19ff08647e2173087f68a87207..fbdc92c08137d47ff7e5aa17f821631d6433f335 100644 (file)
@@ -1629,11 +1629,7 @@ int fdtdec_setup(void)
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 # ifdef CONFIG_OF_EMBED
        /* Get a pointer to the FDT */
-#  ifdef CONFIG_SPL_BUILD
-       gd->fdt_blob = __dtb_dt_spl_begin;
-#  else
-       gd->fdt_blob = __dtb_dt_begin;
-#  endif
+       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(&ret);