All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ovidiu Panait <ovidiu.panait@windriver.com>
To: u-boot@lists.denx.de
Cc: Ovidiu Panait <ovidiu.panait@windriver.com>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	Bin Meng <bmeng.cn@gmail.com>,
	Daniel Schwierzeck <daniel.schwierzeck@gmail.com>,
	Simon Glass <sjg@chromium.org>,
	Tim Harvey <tharvey@gateworks.com>, Wolfgang Denk <wd@denx.de>
Subject: [PATCH 2/7] common: board_r: move bedbug_init() to common code
Date: Sat, 30 Oct 2021 09:51:35 +0300	[thread overview]
Message-ID: <20211030065140.3589529-2-ovidiu.panait@windriver.com> (raw)
In-Reply-To: <20211030065140.3589529-1-ovidiu.panait@windriver.com>

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 c781789e36..e11472ac09 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
  *
-- 
2.25.1


  reply	other threads:[~2021-10-30  6:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-30  6:51 [PATCH 1/7] common: spl: move armv7m-specific code to spl_perform_fixups() Ovidiu Panait
2021-10-30  6:51 ` Ovidiu Panait [this message]
2021-10-30  6:51 ` [PATCH 3/7] common: board_r: drop initr_kgdb wrapper Ovidiu Panait
2021-10-30  6:51 ` [PATCH 4/7] common: board_r: drop initr_addr_map wrapper Ovidiu Panait
2021-11-03 12:15   ` Matthias Brugger
2021-11-05  2:02   ` Simon Glass
2021-10-30  6:51 ` [PATCH 5/7] common: board_r: move init_addr_map() to init.h Ovidiu Panait
2021-10-30  6:51 ` [PATCH 6/7] common: board_r: include asm-generic/gpio.h Ovidiu Panait
2021-10-30  6:51 ` [PATCH 7/7] common: board_r: drop ifdefs around header includes Ovidiu Panait

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211030065140.3589529-2-ovidiu.panait@windriver.com \
    --to=ovidiu.panait@windriver.com \
    --cc=bmeng.cn@gmail.com \
    --cc=daniel.schwierzeck@gmail.com \
    --cc=sjg@chromium.org \
    --cc=takahiro.akashi@linaro.org \
    --cc=tharvey@gateworks.com \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.