diff --git a/lib/ratelimit.c b/lib/ratelimit.c index ce945c17980b9b8addd4c044e1080f73f21a4f3d..da997094d19db1212f6c813b4c5e4f4b1271a8e1 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -26,51 +26,6 @@ */ int ___ratelimit(struct ratelimit_state *rs, const char *func) { - /* Paired with WRITE_ONCE() in .proc_handler(). - * Changing two values seperately could be inconsistent - * and some message could be lost. (See: net_ratelimit_state). - */ - int interval = READ_ONCE(rs->interval); - int burst = READ_ONCE(rs->burst); - unsigned long flags; - int ret; - - if (!interval) - return 1; - - /* - * If we contend on this state's lock then almost - * by definition we are too busy to print a message, - * in addition to the one that will be printed by - * the entity that is holding the lock already: - */ - if (!raw_spin_trylock_irqsave(&rs->lock, flags)) - return 0; - - if (!rs->begin) - rs->begin = jiffies; - - if (time_is_before_jiffies(rs->begin + interval)) { - if (rs->missed) { - if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) { - printk_deferred(KERN_WARNING - "%s: %d callbacks suppressed\n", - func, rs->missed); - rs->missed = 0; - } - } - rs->begin = jiffies; - rs->printed = 0; - } - if (burst && burst > rs->printed) { - rs->printed++; - ret = 1; - } else { - rs->missed++; - ret = 0; - } - raw_spin_unlock_irqrestore(&rs->lock, flags); - - return ret; + return 1; } EXPORT_SYMBOL(___ratelimit);