diff options
Diffstat (limited to 'lib/ratelimit.c')
| -rw-r--r-- | lib/ratelimit.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/ratelimit.c b/lib/ratelimit.c index 09f5ce1810d..40e03ea2a96 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -11,14 +11,19 @@ #include <linux/ratelimit.h> #include <linux/jiffies.h> -#include <linux/module.h> +#include <linux/export.h> /* * __ratelimit - rate limiting * @rs: ratelimit_state data + * @func: name of calling function * - * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks - * in every @rs->ratelimit_jiffies + * This enforces a rate limit: not more than @rs->burst callbacks + * in every @rs->interval + * + * RETURNS: + * 0 means callbacks will be suppressed. + * 1 means go ahead and do it. */ int ___ratelimit(struct ratelimit_state *rs, const char *func) { @@ -34,8 +39,8 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) * in addition to the one that will be printed by * the entity that is holding the lock already: */ - if (!spin_trylock_irqsave(&rs->lock, flags)) - return 1; + if (!raw_spin_trylock_irqsave(&rs->lock, flags)) + return 0; if (!rs->begin) rs->begin = jiffies; @@ -55,7 +60,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) rs->missed++; ret = 0; } - spin_unlock_irqrestore(&rs->lock, flags); + raw_spin_unlock_irqrestore(&rs->lock, flags); return ret; } |
