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>
This commit is contained in:
committed by
David S. Miller
parent
275143e9b2
commit
c7ec2b5855
@@ -21,6 +21,7 @@
|
|||||||
#include <linux/smp.h>
|
#include <linux/smp.h>
|
||||||
#include <linux/bitops.h>
|
#include <linux/bitops.h>
|
||||||
#include <linux/perf_event.h>
|
#include <linux/perf_event.h>
|
||||||
|
#include <linux/ratelimit.h>
|
||||||
#include <asm/fpumacro.h>
|
#include <asm/fpumacro.h>
|
||||||
|
|
||||||
enum direction {
|
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 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))
|
if (__ratelimit(&ratelimit)) {
|
||||||
count = 0;
|
|
||||||
if (count < 5) {
|
|
||||||
last_time = jiffies;
|
|
||||||
count++;
|
|
||||||
printk("Kernel unaligned access at TPC[%lx] %pS\n",
|
printk("Kernel unaligned access at TPC[%lx] %pS\n",
|
||||||
regs->tpc, (void *) regs->tpc);
|
regs->tpc, (void *) regs->tpc);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user