1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LINUX_JUMP_LABEL_RATELIMIT_H 3 #define _LINUX_JUMP_LABEL_RATELIMIT_H 4 5 #include <linux/jump_label.h> 6 #include <linux/workqueue.h> 7 8 #if defined(CONFIG_JUMP_LABEL) 9 struct static_key_deferred { 10 struct static_key key; 11 unsigned long timeout; 12 struct delayed_work work; 13 }; 14 15 extern void static_key_slow_dec_deferred(struct static_key_deferred *key); 16 extern void static_key_deferred_flush(struct static_key_deferred *key); 17 extern void 18 jump_label_rate_limit(struct static_key_deferred *key, unsigned long rl); 19 20 #else /* !CONFIG_JUMP_LABEL */ 21 struct static_key_deferred { 22 struct static_key key; 23 }; static_key_slow_dec_deferred(struct static_key_deferred * key)24static inline void static_key_slow_dec_deferred(struct static_key_deferred *key) 25 { 26 STATIC_KEY_CHECK_USE(key); 27 static_key_slow_dec(&key->key); 28 } static_key_deferred_flush(struct static_key_deferred * key)29static inline void static_key_deferred_flush(struct static_key_deferred *key) 30 { 31 STATIC_KEY_CHECK_USE(key); 32 } 33 static inline void jump_label_rate_limit(struct static_key_deferred * key,unsigned long rl)34jump_label_rate_limit(struct static_key_deferred *key, 35 unsigned long rl) 36 { 37 STATIC_KEY_CHECK_USE(key); 38 } 39 #endif /* CONFIG_JUMP_LABEL */ 40 #endif /* _LINUX_JUMP_LABEL_RATELIMIT_H */ 41