alpha: use __ratelimit

Replace open-coded rate limiting logic with __ratelimit().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: linux-alpha@vger.kernel.org
Signed-off-by: Matt Turner <mattst88@gmail.com>

authored by Akinobu Mita and committed by Matt Turner 2a238a96 39710479

+3 -7
+3 -7
arch/alpha/kernel/traps.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/init.h> 19 19 #include <linux/kallsyms.h> 20 + #include <linux/ratelimit.h> 20 21 21 22 #include <asm/gentrap.h> 22 23 #include <asm/uaccess.h> ··· 772 771 do_entUnaUser(void __user * va, unsigned long opcode, 773 772 unsigned long reg, struct pt_regs *regs) 774 773 { 775 - static int cnt = 0; 776 - static unsigned long last_time; 774 + static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5); 777 775 778 776 unsigned long tmp1, tmp2, tmp3, tmp4; 779 777 unsigned long fake_reg, *reg_addr = &fake_reg; ··· 783 783 with the unaliged access. */ 784 784 785 785 if (!test_thread_flag (TIF_UAC_NOPRINT)) { 786 - if (cnt >= 5 && time_after(jiffies, last_time + 5 * HZ)) { 787 - cnt = 0; 788 - } 789 - if (++cnt < 5) { 786 + if (__ratelimit(&ratelimit)) { 790 787 printk("%s(%d): unaligned trap at %016lx: %p %lx %ld\n", 791 788 current->comm, task_pid_nr(current), 792 789 regs->pc - 4, va, opcode, reg); 793 790 } 794 - last_time = jiffies; 795 791 } 796 792 if (test_thread_flag (TIF_UAC_SIGBUS)) 797 793 goto give_sigbus;