Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec...
[linux-2.6/btrfs-unstable.git] / include / linux / jump_label_ratelimit.h
blobbaa8eabbaa56b7ef2c8367ee7a5c407b27cb18c8
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_JUMP_LABEL_RATELIMIT_H
3 #define _LINUX_JUMP_LABEL_RATELIMIT_H
5 #include <linux/jump_label.h>
6 #include <linux/workqueue.h>
8 #if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
9 struct static_key_deferred {
10 struct static_key key;
11 unsigned long timeout;
12 struct delayed_work work;
14 #endif
16 #ifdef HAVE_JUMP_LABEL
17 extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
18 extern void static_key_deferred_flush(struct static_key_deferred *key);
19 extern void
20 jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
22 #else /* !HAVE_JUMP_LABEL */
23 struct static_key_deferred {
24 struct static_key key;
26 static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
28 STATIC_KEY_CHECK_USE(key);
29 static_key_slow_dec(&key->key);
31 static inline void static_key_deferred_flush(struct static_key_deferred *key)
33 STATIC_KEY_CHECK_USE(key);
35 static inline void
36 jump_label_rate_limit(struct static_key_deferred *key,
37 unsigned long rl)
39 STATIC_KEY_CHECK_USE(key);
41 #endif /* HAVE_JUMP_LABEL */
42 #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */