Prepare v2025.01
[u-boot.git] / include / initcall.h
blob62d3bb67f089318e22f7a847cb887c2cfa0458d0
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3 * Copyright (c) 2011 The Chromium OS Authors.
4 */
6 #ifndef __INITCALL_H
7 #define __INITCALL_H
9 #include <asm/types.h>
10 #include <event.h>
12 _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits");
14 /**
15 * init_fnc_t - Init function
17 * Return: 0 if OK -ve on error
19 typedef int (*init_fnc_t)(void);
21 /* Top bit indicates that the initcall is an event */
22 #define INITCALL_IS_EVENT GENMASK(BITS_PER_LONG - 1, 8)
23 #define INITCALL_EVENT_TYPE GENMASK(7, 0)
25 #define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT)
27 /**
28 * initcall_run_list() - Run through a list of function calls
30 * This calls functions one after the other, stopping at the first error, or
31 * when NULL is obtained.
33 * @init_sequence: NULL-terminated init sequence to run
34 * Return: 0 if OK, or -ve error code from the first failure
36 int initcall_run_list(const init_fnc_t init_sequence[]);
38 #endif