fdt: Swap the signature for board_fdt_blob_setup()
This returns a devicetree and updates a parameter with an error code.
Swap it, since this fits better with the way U-Boot normally works. It
also (more easily) allows leaving the existing pointer unchanged.
No yaks were harmed in this change, but there is a very small code-size
reduction.
For sifive, the OF_BOARD option must be set for the function to be
called, so there is no point in checking it again. Also OF_SEPARATE is
defined always.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
[trini: Update total_compute]
Signed-off-by: Tom Rini <trini@konsulko.com>
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index a12dccd..deea6c7 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -358,17 +358,17 @@
}
#if defined(CONFIG_OF_BOARD)
-void *board_fdt_blob_setup(int *err)
+int board_fdt_blob_setup(void **fdtp)
{
void *fdt_blob;
- *err = 0;
-
if (IS_ENABLED(CONFIG_TARGET_XILINX_MBV)) {
fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
- if (fdt_magic(fdt_blob) == FDT_MAGIC)
- return fdt_blob;
+ if (fdt_magic(fdt_blob) == FDT_MAGIC) {
+ *fdtp = fdt_blob;
+ return 0;
+ }
}
if (!IS_ENABLED(CONFIG_XPL_BUILD) &&
@@ -376,8 +376,10 @@
!IS_ENABLED(CONFIG_ZYNQMP_NO_DDR)) {
fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR;
- if (fdt_magic(fdt_blob) == FDT_MAGIC)
- return fdt_blob;
+ if (fdt_magic(fdt_blob) == FDT_MAGIC) {
+ *fdtp = fdt_blob;
+ return 0;
+ }
debug("DTB is not passed via %p\n", fdt_blob);
}
@@ -396,13 +398,15 @@
fdt_blob = (ulong *)_end;
}
- if (fdt_magic(fdt_blob) == FDT_MAGIC)
- return fdt_blob;
+ if (fdt_magic(fdt_blob) == FDT_MAGIC) {
+ *fdtp = fdt_blob;
+
+ return 0;
+ }
debug("DTB is also not passed via %p\n", fdt_blob);
- *err = -EINVAL;
- return NULL;
+ return -EINVAL;
}
#endif