diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2010-02-28 06:31:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-28 06:31:29 -0500 |
commit | c7ec2b585525477f393942ecb18fff1f5e259118 (patch) | |
tree | d7c5819148bf05305dbad11aa94a7e070b0548cc /arch/sparc/kernel/unaligned_64.c | |
parent | 275143e9b237dd7e0b6d01660fd9b8acd9922fa7 (diff) |
sparc: use __ratelimit
Replace open-coded rate limiting logic with __ratelimit().
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/unaligned_64.c')
-rw-r--r-- | arch/sparc/kernel/unaligned_64.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c index a9bc6c696ca6..ebce43018c49 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/smp.h> | 21 | #include <linux/smp.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/perf_event.h> | 23 | #include <linux/perf_event.h> |
24 | #include <linux/ratelimit.h> | ||
24 | #include <asm/fpumacro.h> | 25 | #include <asm/fpumacro.h> |
25 | 26 | ||
26 | enum direction { | 27 | enum direction { |
@@ -274,13 +275,9 @@ static void kernel_mna_trap_fault(int fixup_tstate_asi) | |||
274 | 275 | ||
275 | static void log_unaligned(struct pt_regs *regs) | 276 | static void log_unaligned(struct pt_regs *regs) |
276 | { | 277 | { |
277 | static unsigned long count, last_time; | 278 | static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5); |
278 | 279 | ||
279 | if (time_after(jiffies, last_time + 5 * HZ)) | 280 | if (__ratelimit(&ratelimit)) { |
280 | count = 0; | ||
281 | if (count < 5) { | ||
282 | last_time = jiffies; | ||
283 | count++; | ||
284 | printk("Kernel unaligned access at TPC[%lx] %pS\n", | 281 | printk("Kernel unaligned access at TPC[%lx] %pS\n", |
285 | regs->tpc, (void *) regs->tpc); | 282 | regs->tpc, (void *) regs->tpc); |
286 | } | 283 | } |