Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
36 lines
709 B
C
36 lines
709 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _DELAYED_CALL_H
|
|
#define _DELAYED_CALL_H
|
|
|
|
/*
|
|
* Poor man's closures; I wish we could've done them sanely polymorphic,
|
|
* but...
|
|
*/
|
|
|
|
struct delayed_call {
|
|
void (*fn)(void *);
|
|
void *arg;
|
|
};
|
|
|
|
#define DEFINE_DELAYED_CALL(name) struct delayed_call name = {NULL, NULL}
|
|
|
|
/* I really wish we had closures with sane typechecking... */
|
|
static inline void set_delayed_call(struct delayed_call *call,
|
|
void (*fn)(void *), void *arg)
|
|
{
|
|
call->fn = fn;
|
|
call->arg = arg;
|
|
}
|
|
|
|
static inline void do_delayed_call(struct delayed_call *call)
|
|
{
|
|
if (call->fn)
|
|
call->fn(call->arg);
|
|
}
|
|
|
|
static inline void clear_delayed_call(struct delayed_call *call)
|
|
{
|
|
call->fn = NULL;
|
|
}
|
|
#endif
|