Commit 8260cf6f authored by Akinobu Mita's avatar Akinobu Mita Committed by Benjamin Herrenschmidt

powerpc/iseries/pci: Use __ratelimit

Replace open-coded rate limiting logic with __ratelimit().
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 7545ba6f
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/ratelimit.h>
#include <asm/types.h> #include <asm/types.h>
#include <asm/io.h> #include <asm/io.h>
...@@ -584,14 +585,9 @@ static inline struct device_node *xlate_iomm_address( ...@@ -584,14 +585,9 @@ static inline struct device_node *xlate_iomm_address(
orig_addr = (unsigned long __force)addr; orig_addr = (unsigned long __force)addr;
if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) { if ((orig_addr < BASE_IO_MEMORY) || (orig_addr >= max_io_memory)) {
static unsigned long last_jiffies; static DEFINE_RATELIMIT_STATE(ratelimit, 60 * HZ, 10);
static int num_printed;
if (time_after(jiffies, last_jiffies + 60 * HZ)) { if (__ratelimit(&ratelimit))
last_jiffies = jiffies;
num_printed = 0;
}
if (num_printed++ < 10)
printk(KERN_ERR printk(KERN_ERR
"iSeries_%s: invalid access at IO address %p\n", "iSeries_%s: invalid access at IO address %p\n",
func, addr); func, addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment