blob: 089f70f83e97c9a1adf1087f10d095a02bd3e152 [file] [log] [blame]
Andrew Jones851cf6e2013-08-09 19:51:57 +05301#ifndef _LINUX_JUMP_LABEL_RATELIMIT_H
2#define _LINUX_JUMP_LABEL_RATELIMIT_H
3
4#include <linux/jump_label.h>
5#include <linux/workqueue.h>
6
7#if defined(CC_HAVE_ASM_GOTO) && defined(CONFIG_JUMP_LABEL)
8struct static_key_deferred {
9 struct static_key key;
10 unsigned long timeout;
11 struct delayed_work work;
12};
13#endif
14
15#ifdef HAVE_JUMP_LABEL
16extern void static_key_slow_dec_deferred(struct static_key_deferred *key);
17extern void
18jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl);
19
20#else /* !HAVE_JUMP_LABEL */
21struct static_key_deferred {
22 struct static_key key;
23};
24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key)
25{
Hannes Frederic Sowac4b2c0c2013-10-19 21:48:53 +020026 STATIC_KEY_CHECK_USE();
Andrew Jones851cf6e2013-08-09 19:51:57 +053027 static_key_slow_dec(&key->key);
28}
29static inline void
30jump_label_rate_limit(struct static_key_deferred *key,
31 unsigned long rl)
32{
Hannes Frederic Sowac4b2c0c2013-10-19 21:48:53 +020033 STATIC_KEY_CHECK_USE();
Andrew Jones851cf6e2013-08-09 19:51:57 +053034}
35#endif /* HAVE_JUMP_LABEL */
36#endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */