diff mbox series

board_r: use IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) in board_init_r()

Message ID 20220502153456.2670982-1-ovidiu.panait@windriver.com
State Accepted
Commit 13ae36cc8d3dfc09765db261f38fbf5992ec7b3f
Delegated to: Tom Rini
Headers show
Series board_r: use IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC) in board_init_r() | expand

Commit Message

Ovidiu Panait May 2, 2022, 3:34 p.m. UTC
Drop CONFIG_NEEDS_MANUAL_RELOC ifdefs in board_init_r() and use
IS_ENABLED() instead. Also, use the MANUAL_RELOC() macro to update the
initcall pointers.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---

 common/board_r.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Tom Rini May 11, 2022, 5:31 p.m. UTC | #1
On Mon, May 02, 2022 at 06:34:56PM +0300, Ovidiu Panait wrote:

> Drop CONFIG_NEEDS_MANUAL_RELOC ifdefs in board_init_r() and use
> IS_ENABLED() instead. Also, use the MANUAL_RELOC() macro to update the
> initcall pointers.
> 
> Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/board_r.c b/common/board_r.c
index 93c9c2e50d..6f4aca2077 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -61,6 +61,7 @@ 
 #include <wdt.h>
 #include <asm-generic/gpio.h>
 #include <efi_loader.h>
+#include <relocate.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -810,19 +811,15 @@  void board_init_r(gd_t *new_gd, ulong dest_addr)
 	if (CONFIG_IS_ENABLED(X86_64) && !IS_ENABLED(CONFIG_EFI_APP))
 		arch_setup_gd(new_gd);
 
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-	int i;
-#endif
-
 #if !defined(CONFIG_X86) && !defined(CONFIG_ARM) && !defined(CONFIG_ARM64)
 	gd = new_gd;
 #endif
 	gd->flags &= ~GD_FLG_LOG_READY;
 
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-	for (i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
-		init_sequence_r[i] += gd->reloc_off;
-#endif
+	if (IS_ENABLED(CONFIG_NEEDS_MANUAL_RELOC)) {
+		for (int i = 0; i < ARRAY_SIZE(init_sequence_r); i++)
+			MANUAL_RELOC(init_sequence_r[i]);
+	}
 
 	if (initcall_run_list(init_sequence_r))
 		hang();