diff options
| author | Tom Rini <[email protected]> | 2025-04-14 08:59:45 -0600 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-04-14 08:59:45 -0600 |
| commit | 8c98b57d72d5e5b94ed064fe1041e51216165334 (patch) | |
| tree | 6925274aa6ebc5a369da5552bf88260f1730d2bc /include | |
| parent | 739ad58dbee874a3ad3bddd116e995212a254e07 (diff) | |
| parent | bbee3d41b33f5b8c88ae3707dc8af105acafdd55 (diff) | |
Merge patch series "Static initcalls"
Jerome Forissier <[email protected]> says:
This series replaces the dynamic initcalls (with function pointers) with
static calls, and gets rid of initcall_run_list(), init_sequence_f,
init_sequence_f_r and init_sequence_r. This makes the code simpler and the
binary slighlty smaller: -2281 bytes/-0.21 % with LTO enabled and -510
bytes/-0.05 % with LTO disabled (xilinx_zynqmp_kria_defconfig).
Execution time doesn't seem to change noticeably. There is no impact on
the SPL.
The inline assembly fixes, although they look unrelated, are triggered
on some platforms with LTO enabled. For example: kirkwood_defconfig.
CI: https://source.denx.de/u-boot/custodians/u-boot-net/-/pipelines/25514
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'include')
| -rw-r--r-- | include/initcall.h | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/include/initcall.h b/include/initcall.h index 62d3bb67f08..220a55ad84d 100644 --- a/include/initcall.h +++ b/include/initcall.h @@ -8,31 +8,34 @@ #include <asm/types.h> #include <event.h> +#include <hang.h> _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); -/** - * init_fnc_t - Init function - * - * Return: 0 if OK -ve on error - */ -typedef int (*init_fnc_t)(void); - -/* Top bit indicates that the initcall is an event */ -#define INITCALL_IS_EVENT GENMASK(BITS_PER_LONG - 1, 8) -#define INITCALL_EVENT_TYPE GENMASK(7, 0) +#define INITCALL(_call) \ + do { \ + if (_call()) { \ + printf("%s(): initcall %s() failed\n", __func__, \ + #_call); \ + hang(); \ + } \ + } while (0) -#define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT) +#define INITCALL_EVT(_evt) \ + do { \ + if (event_notify_null(_evt)) { \ + printf("%s(): event %d/%s failed\n", __func__, _evt, \ + event_type_name(_evt)) ; \ + hang(); \ + } \ + } while (0) -/** - * initcall_run_list() - Run through a list of function calls - * - * This calls functions one after the other, stopping at the first error, or - * when NULL is obtained. - * - * @init_sequence: NULL-terminated init sequence to run - * Return: 0 if OK, or -ve error code from the first failure - */ -int initcall_run_list(const init_fnc_t init_sequence[]); +#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) +#define WATCHDOG_INIT() INITCALL(init_func_watchdog_init) +#define WATCHDOG_RESET() INITCALL(init_func_watchdog_reset) +#else +#define WATCHDOG_INIT() +#define WATCHDOG_RESET() +#endif #endif |
