1/* SPDX-License-Identifier: GPL-2.0+ */ 2/* 3 * Copyright (c) 2011 The Chromium OS Authors. 4 */ 5 6#ifndef __INITCALL_H 7#define __INITCALL_H 8 9#include <asm/types.h> 10#include <event.h> 11 12_Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits"); 13 14/** 15 * init_fnc_t - Init function 16 * 17 * Return: 0 if OK -ve on error 18 */ 19typedef int (*init_fnc_t)(void); 20 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) 24 25#define INITCALL_EVENT(_type) (void *)((_type) | INITCALL_IS_EVENT) 26 27/** 28 * initcall_run_list() - Run through a list of function calls 29 * 30 * This calls functions one after the other, stopping at the first error, or 31 * when NULL is obtained. 32 * 33 * @init_sequence: NULL-terminated init sequence to run 34 * Return: 0 if OK, or -ve error code from the first failure 35 */ 36int initcall_run_list(const init_fnc_t init_sequence[]); 37 38#endif 39