Symbols exclusively defined in common.h are a problem, because other headers that require them will need to include a lot of extra baggage, which in the worst case can lead to cyclic dependencies and in every case leads to longer compile times. In preparation for turning common.h into containing only #include lines, let's move the barebox boot stage stuff into a separate header. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- include/barebox.h | 35 +++++++++++++++++++++++++++++++++++ include/common.h | 28 +--------------------------- 2 files changed, 36 insertions(+), 27 deletions(-) create mode 100644 include/barebox.h diff --git a/include/barebox.h b/include/barebox.h new file mode 100644 index 000000000000..741463bc1cf9 --- /dev/null +++ b/include/barebox.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __BAREBOX_H_ +#define __BAREBOX_H_ + +#include <linux/compiler.h> + +/* For use when unrelocated */ +static inline void __hang(void) +{ + while (1); +} +void __noreturn hang (void); + +/* + * Function pointer to the main barebox function. Defaults + * to run_shell() when a shell is enabled. + */ +extern int (*barebox_main)(void); + +enum autoboot_state { + AUTOBOOT_COUNTDOWN, + AUTOBOOT_ABORT, + AUTOBOOT_MENU, + AUTOBOOT_BOOT, + AUTOBOOT_UNKNOWN, +}; + +void set_autoboot_state(enum autoboot_state autoboot); +enum autoboot_state do_autoboot_countdown(void); + +void __noreturn start_barebox(void); +void shutdown_barebox(void); + +#endif diff --git a/include/common.h b/include/common.h index 571f46fd0bc1..cc7f089aeef0 100644 --- a/include/common.h +++ b/include/common.h @@ -8,6 +8,7 @@ #define __COMMON_H_ 1 #include <stdio.h> +#include <barebox.h> #include <module.h> #include <config.h> #include <clock.h> @@ -45,14 +46,6 @@ */ void reginfo(void); -/* For use when unrelocated */ -static inline void __hang(void) -{ - while (1); -} - -void __noreturn hang (void); - char *size_human_readable(unsigned long long size); int readline (const char *prompt, char *buf, int len); @@ -76,25 +69,6 @@ int parse_area_spec(const char *str, loff_t *start, loff_t *size); unsigned long strtoul_suffix(const char *str, char **endp, int base); unsigned long long strtoull_suffix(const char *str, char **endp, int base); -/* - * Function pointer to the main barebox function. Defaults - * to run_shell() when a shell is enabled. - */ -extern int (*barebox_main)(void); - -enum autoboot_state { - AUTOBOOT_COUNTDOWN, - AUTOBOOT_ABORT, - AUTOBOOT_MENU, - AUTOBOOT_BOOT, - AUTOBOOT_UNKNOWN, -}; - -void set_autoboot_state(enum autoboot_state autoboot); -enum autoboot_state do_autoboot_countdown(void); - -void __noreturn start_barebox(void); -void shutdown_barebox(void); int mem_parse_options(int argc, char *argv[], char *optstr, int *mode, char **sourcefile, char **destfile, int *swab); int memcpy_parse_options(int argc, char *argv[], int *sourcefd, -- 2.39.5