aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorHiroshi DOYU <hdoyu@nvidia.com>2012-05-14 03:47:57 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-05-14 11:47:11 -0400
commit6ca045930338485a8cdef117e74372aa1678009d (patch)
treeb48243eeca23dc1b3b29e365d5b420ba121ff124 /include/linux/device.h
parent094e47e9fa79e28f0e51e37400ea6eea35a4ee1f (diff)
driver core: Add dev_*_ratelimited() family
Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited(). Using Joe Perches's proposal/implementation. Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com> Cc: Joe Perches <joe@perches.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r--include/linux/device.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 863acf8a0dce..a8db2cfa2c81 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -23,6 +23,7 @@
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/atomic.h> 25#include <linux/atomic.h>
26#include <linux/ratelimit.h>
26#include <asm/device.h> 27#include <asm/device.h>
27 28
28struct device; 29struct device;
@@ -933,6 +934,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...)
933 934
934#endif 935#endif
935 936
937#define dev_level_ratelimited(dev_level, dev, fmt, ...) \
938do { \
939 static DEFINE_RATELIMIT_STATE(_rs, \
940 DEFAULT_RATELIMIT_INTERVAL, \
941 DEFAULT_RATELIMIT_BURST); \
942 if (__ratelimit(&_rs)) \
943 dev_level(dev, fmt, ##__VA_ARGS__); \
944} while (0)
945
946#define dev_emerg_ratelimited(dev, fmt, ...) \
947 dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
948#define dev_alert_ratelimited(dev, fmt, ...) \
949 dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
950#define dev_crit_ratelimited(dev, fmt, ...) \
951 dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__)
952#define dev_err_ratelimited(dev, fmt, ...) \
953 dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__)
954#define dev_warn_ratelimited(dev, fmt, ...) \
955 dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__)
956#define dev_notice_ratelimited(dev, fmt, ...) \
957 dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__)
958#define dev_info_ratelimited(dev, fmt, ...) \
959 dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__)
960#define dev_dbg_ratelimited(dev, fmt, ...) \
961 dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__)
962
936/* 963/*
937 * Stupid hackaround for existing uses of non-printk uses dev_info 964 * Stupid hackaround for existing uses of non-printk uses dev_info
938 * 965 *