diff options
Diffstat (limited to 'include/linux/ratelimit.h')
-rw-r--r-- | include/linux/ratelimit.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h index 668cf1b..8f69d09 100644 --- a/include/linux/ratelimit.h +++ b/include/linux/ratelimit.h @@ -2,7 +2,7 @@ #define _LINUX_RATELIMIT_H #include <linux/param.h> -#include <linux/spinlock_types.h> +#include <linux/spinlock.h> #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) #define DEFAULT_RATELIMIT_BURST 10 @@ -25,6 +25,17 @@ struct ratelimit_state { .burst = burst_init, \ } +static inline void ratelimit_state_init(struct ratelimit_state *rs, + int interval, int burst) +{ + spin_lock_init(&rs->lock); + rs->interval = interval; + rs->burst = burst; + rs->printed = 0; + rs->missed = 0; + rs->begin = 0; +} + extern int ___ratelimit(struct ratelimit_state *rs, const char *func); #define __ratelimit(state) ___ratelimit(state, __func__) |