]> Git Repo - linux.git/commitdiff
sparc: use __ratelimit
authorAkinobu Mita <[email protected]>
Sun, 28 Feb 2010 11:31:29 +0000 (03:31 -0800)
committerDavid S. Miller <[email protected]>
Sun, 28 Feb 2010 11:31:29 +0000 (03:31 -0800)
Replace open-coded rate limiting logic with __ratelimit().

Signed-off-by: Akinobu Mita <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
arch/sparc/kernel/unaligned_64.c

index a9bc6c696ca6e8aad203522d96d9d06edc46628d..ebce43018c49c00b5aceacc97fba173df6abef2a 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/smp.h>
 #include <linux/bitops.h>
 #include <linux/perf_event.h>
+#include <linux/ratelimit.h>
 #include <asm/fpumacro.h>
 
 enum direction {
@@ -274,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi)
 
 static void log_unaligned(struct pt_regs *regs)
 {
-       static unsigned long count, last_time;
+       static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
 
-       if (time_after(jiffies, last_time + 5 * HZ))
-               count = 0;
-       if (count < 5) {
-               last_time = jiffies;
-               count++;
+       if (__ratelimit(&ratelimit)) {
                printk("Kernel unaligned access at TPC[%lx] %pS\n",
                       regs->tpc, (void *) regs->tpc);
        }
This page took 0.055953 seconds and 4 git commands to generate.