License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[linux-2.6/btrfs-unstable.git] / include / linux / delayed_call.h
bloba26c3b95b5cf5b63a06efc95c694e5feeca16ecd
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _DELAYED_CALL_H
3 #define _DELAYED_CALL_H
5 /*
6 * Poor man's closures; I wish we could've done them sanely polymorphic,
7 * but...
8 */
10 struct delayed_call {
11 void (*fn)(void *);
12 void *arg;
15 #define DEFINE_DELAYED_CALL(name) struct delayed_call name = {NULL, NULL}
17 /* I really wish we had closures with sane typechecking... */
18 static inline void set_delayed_call(struct delayed_call *call,
19 void (*fn)(void *), void *arg)
21 call->fn = fn;
22 call->arg = arg;
25 static inline void do_delayed_call(struct delayed_call *call)
27 if (call->fn)
28 call->fn(call->arg);
31 static inline void clear_delayed_call(struct delayed_call *call)
33 call->fn = NULL;
35 #endif