[Concept,05/18] sandbox: Move main.h contents into u-boot-sandbox header

Message ID 20250904130459.848794-6-sjg@u-boot.org
State New
Headers
Series ulib: Introduce building U-Boot as a shared library |

Commit Message

Simon Glass Sept. 4, 2025, 1:04 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

It isn't really necessary to have a header file for just one function.
This makes it harder to see the full interface provided by sandbox.

Move the sandbox_main() declaration into u-boot-sandbox.h

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 arch/sandbox/cpu/os.c                     |  2 +-
 arch/sandbox/include/asm/main.h           | 18 ------------------
 arch/sandbox/include/asm/u-boot-sandbox.h | 12 ++++++++++++
 3 files changed, 13 insertions(+), 19 deletions(-)
 delete mode 100644 arch/sandbox/include/asm/main.h
  

Patch

diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 101d695a556..d1632e6af69 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -30,9 +30,9 @@ 
 
 #include <asm/fuzzing_engine.h>
 #include <asm/getopt.h>
-#include <asm/main.h>
 #include <asm/sections.h>
 #include <asm/state.h>
+#include <asm/u-boot-sandbox.h>
 #include <os.h>
 #include <rtc_def.h>
 
diff --git a/arch/sandbox/include/asm/main.h b/arch/sandbox/include/asm/main.h
deleted file mode 100644
index 7a2f0d3a8d5..00000000000
--- a/arch/sandbox/include/asm/main.h
+++ /dev/null
@@ -1,18 +0,0 @@ 
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright (c) 2022 Google, Inc.
- * Written by Andrew Scull <ascull@google.com>
- */
-
-#ifndef __ASM_SANDBOX_MAIN_H
-#define __ASM_SANDBOX_MAIN_H
-
-/**
- * sandbox_main() - main entrypoint for sandbox
- *
- * @argc:	the number of arguments passed to the program
- * @argv:	array of argc+1 pointers, of which the last one is null
- */
-int sandbox_main(int argc, char *argv[]);
-
-#endif /* __ASM_SANDBOX_MAIN_H */
diff --git a/arch/sandbox/include/asm/u-boot-sandbox.h b/arch/sandbox/include/asm/u-boot-sandbox.h
index 3c4347117d4..54f0d9832b1 100644
--- a/arch/sandbox/include/asm/u-boot-sandbox.h
+++ b/arch/sandbox/include/asm/u-boot-sandbox.h
@@ -41,4 +41,16 @@  void sandbox_reset(void);
 /* Exit sandbox (quit U-Boot) */
 void __noreturn sandbox_exit(void);
 
+/**
+ * sandbox_main() - main entrypoint for sandbox
+ *
+ * @argc:	the number of arguments passed to the program
+ * @argv:	array of argc+1 pointers, of which the last one is null
+
+ * This starts sandbox. It does not return unless something goes wrong.
+ *
+ * Return: 1 on error
+ */
+int sandbox_main(int argc, char *argv[]);
+
 #endif	/* _U_BOOT_SANDBOX_H_ */