summaryrefslogtreecommitdiffstats
path: root/arch/sparc/kernel/unaligned_64.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2010-02-28 12:31:29 +0100
committerDavid S. Miller <davem@davemloft.net>2010-02-28 12:31:29 +0100
commitc7ec2b585525477f393942ecb18fff1f5e259118 (patch)
treed7c5819148bf05305dbad11aa94a7e070b0548cc /arch/sparc/kernel/unaligned_64.c
parentsunxvr500: Additional PCI id for sunxvr500 driver (diff)
downloadlinux-c7ec2b585525477f393942ecb18fff1f5e259118.tar.xz
linux-c7ec2b585525477f393942ecb18fff1f5e259118.zip
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.c9
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 @@
#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);
}