
bedbug/types.h is included to provide bedbug_init() declaration, which is an empty stub that is only called from the common init sequence. In order to get rid of this dependency and the associated #ifdef: * move the bedbug_init() declaration from include/bedbug/type.h to include/init.h * provide a weak stub for bedbug_init() in board_r.c, so each CPU can provide its own implementation, as explained in the function comment
Signed-off-by: Ovidiu Panait ovidiu.panait@windriver.com ---
cmd/bedbug.c | 14 -------------- common/board_r.c | 10 ++++++---- include/bedbug/type.h | 1 - include/init.h | 11 +++++++++++ 4 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/cmd/bedbug.c b/cmd/bedbug.c index 0bd67fcf47..7fc206bd26 100644 --- a/cmd/bedbug.c +++ b/cmd/bedbug.c @@ -38,20 +38,6 @@ int bedbug_puts (const char *str) return 0; } /* bedbug_puts */
- -/* ====================================================================== - * Initialize the bug_ctx structure used by the bedbug debugger. This is - * specific to the CPU since each has different debug registers and - * settings. - * ====================================================================== */ - -int bedbug_init(void) -{ - /* -------------------------------------------------- */ - return 0; -} /* bedbug_init */ - - /* ====================================================================== * Entry point from the interpreter to the disassembler. Repeated calls * will resume from the last disassembled address. diff --git a/common/board_r.c b/common/board_r.c index 31a59c585a..a5c1af9c1f 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -23,10 +23,6 @@ #include <asm/cache.h> #include <asm/global_data.h> #include <u-boot/crc.h> -/* TODO: can we just include all these headers whether needed or not? */ -#if defined(CONFIG_CMD_BEDBUG) -#include <bedbug/type.h> -#endif #include <binman.h> #include <command.h> #include <console.h> @@ -37,6 +33,7 @@ #include <ide.h> #include <init.h> #include <initcall.h> +/* TODO: can we just include all these headers whether needed or not? */ #if defined(CONFIG_CMD_KGDB) #include <kgdb.h> #endif @@ -568,6 +565,11 @@ static int initr_ide(void) } #endif
+__weak int bedbug_init(void) +{ + return 0; +} + #if defined(CONFIG_PRAM) /* * Export available size of memory for Linux, taking into account the diff --git a/include/bedbug/type.h b/include/bedbug/type.h index f7a719caf0..99c3d4d83e 100644 --- a/include/bedbug/type.h +++ b/include/bedbug/type.h @@ -5,7 +5,6 @@ struct cmd_tbl;
/* Supporting routines */ int bedbug_puts (const char *); -int bedbug_init(void); void bedbug860_init (void); void do_bedbug_breakpoint (struct pt_regs *); void bedbug_main_loop (unsigned long, struct pt_regs *); diff --git a/include/init.h b/include/init.h index f2cd46dead..7e0149c004 100644 --- a/include/init.h +++ b/include/init.h @@ -307,6 +307,17 @@ int board_early_init_r(void); */ int arch_initr_trap(void);
+/** + * bedbug_init() - init bedbug debugger + * + * Initialize the bug_ctx structure used by the bedbug debugger. This is + * specific to the CPU since each has different debug registers and + * settings. + * + * Return: 0 if OK + */ +int bedbug_init(void); + /** * main_loop() - Enter the main loop of U-Boot *