common: board_r: drop initr_kgdb wrapper
authorOvidiu Panait <ovidiu.panait@windriver.com>
Sat, 1 Jan 2022 17:13:27 +0000 (19:13 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 18 Jan 2022 13:31:02 +0000 (08:31 -0500)
Add a return value to kgdb_init and use it directly in the post-relocation
init sequence, rather than using a wrapper stub. Also, move the "KGDB"
print message inside kgdb_init().

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
common/board_r.c
common/kgdb.c
include/kgdb.h

index f81d21a..f12e245 100644 (file)
@@ -498,15 +498,6 @@ static int initr_ethaddr(void)
 }
 #endif /* CONFIG_CMD_NET */
 
-#ifdef CONFIG_CMD_KGDB
-static int initr_kgdb(void)
-{
-       puts("KGDB:  ");
-       kgdb_init();
-       return 0;
-}
-#endif
-
 #if defined(CONFIG_LED_STATUS)
 static int initr_status_led(void)
 {
@@ -769,7 +760,7 @@ static init_fnc_t init_sequence_r[] = {
 #endif
        INIT_FUNC_WATCHDOG_RESET
 #ifdef CONFIG_CMD_KGDB
-       initr_kgdb,
+       kgdb_init,
 #endif
        interrupt_init,
 #if defined(CONFIG_MICROBLAZE) || defined(CONFIG_M68K)
index 4493a15..29b09fc 100644 (file)
@@ -527,15 +527,18 @@ handle_exception (struct pt_regs *regs)
  * kgdb_init must be called *after* the
  * monitor is relocated into ram
  */
-void
-kgdb_init(void)
+int kgdb_init(void)
 {
+       puts("KGDB:  ");
+
        kgdb_serial_init();
        debugger_exception_handler = handle_exception;
        initialized = 1;
 
        putDebugStr("kgdb ready\n");
        puts("ready\n");
+
+       return 0;
 }
 
 void
index 616ce44..bdba347 100644 (file)
@@ -39,7 +39,16 @@ typedef
 kgdb_data;
 
 /* these functions are provided by the generic kgdb support */
-extern void kgdb_init(void);
+/**
+ * kgdb_init()
+ *
+ * Perform initializations to allow debugging U-Boot with gdb over a serial
+ * link. It is called during the generic board init sequence.
+ *
+ * Return: 0 if OK
+ */
+int kgdb_init(void);
+
 extern void kgdb_error(int);
 extern int kgdb_output_string(const char *, unsigned int);
 extern void breakpoint(void);