diff mbox series

[U-Boot,v6,11/13] include: board: provide empty stubs when the BOARD option is not selected

Message ID 20191022143922.10205-12-jjhiblot@ti.com
State Accepted
Commit 02806e9ac1fbff2f1507f5565d738ac4e3c25709
Delegated to: Tom Rini
Headers show
Series Add support for applications of overlays in SPL | expand

Commit Message

Jean-Jacques Hiblot Oct. 22, 2019, 2:39 p.m. UTC
Useful to avoid #ifdef throughout the code that uses the board driver API.

Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/board.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

Comments

Tom Rini Jan. 8, 2020, 8:11 p.m. UTC | #1
On Tue, Oct 22, 2019 at 04:39:20PM +0200, Jean-Jacques Hiblot wrote:

> Useful to avoid #ifdef throughout the code that uses the board driver API.
> 
> Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

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

Patch

diff --git a/include/board.h b/include/board.h
index fd6a486702..678b652b0a 100644
--- a/include/board.h
+++ b/include/board.h
@@ -31,6 +31,7 @@ 
  * to read the serial number.
  */
 
+#if CONFIG_IS_ENABLED(BOARD)
 struct board_ops {
 	/**
 	 * detect() - Run the hardware info detection procedure for this
@@ -174,3 +175,39 @@  int board_get(struct udevice **devp);
  */
 int board_get_fit_loadable(struct udevice *dev, int index,
 			   const char *type, const char **strp);
+
+#else
+
+static inline int board_detect(struct udevice *dev)
+{
+	return -ENOSYS;
+}
+
+static inline int board_get_bool(struct udevice *dev, int id, bool *val)
+{
+	return -ENOSYS;
+}
+
+static inline int board_get_int(struct udevice *dev, int id, int *val)
+{
+	return -ENOSYS;
+}
+
+static inline int board_get_str(struct udevice *dev, int id, size_t size,
+				char *val)
+{
+	return -ENOSYS;
+}
+
+static inline int board_get(struct udevice **devp)
+{
+	return -ENOSYS;
+}
+
+static inline int board_get_fit_loadable(struct udevice *dev, int index,
+					 const char *type, const char **strp)
+{
+	return -ENOSYS;
+}
+
+#endif