From patchwork Sun Feb 28 10:58:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: sparc: use __ratelimit Date: Sun, 28 Feb 2010 00:58:17 -0000 From: Akinobu Mita X-Patchwork-Id: 46490 Message-Id: <1267354697-6456-5-git-send-email-akinobu.mita@gmail.com> To: linux-kernel@vger.kernel.org Cc: Akinobu Mita , "David S. Miller" , sparclinux@vger.kernel.org Replace open-coded rate limiting logic with __ratelimit(). Signed-off-by: Akinobu Mita Cc: "David S. Miller" Cc: sparclinux@vger.kernel.org --- 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 378ca82..f03641f 100644 --- a/arch/sparc/kernel/unaligned_64.c +++ b/arch/sparc/kernel/unaligned_64.c @@ -21,6 +21,7 @@ #include #include #include +#include #include 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); }