aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-05-26 15:00:31 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-26 15:00:31 -0400
commit86e4ca66e81bba0f8640f1fa19b8b8f72cbd0561 (patch)
treec0192a77bea66f9e58b62a17f9ddd8ce0fb64233 /include/linux
parent90e62474fd08e16ba5309886c801243b0eb782f3 (diff)
bug.h: Move ratelimit warn interfaces to ratelimit.h
As reported by Ingo Molnar, we still have configuration combinations where use of the WARN_RATELIMIT interfaces break the build because dependencies don't get met. Instead of going down the long road of trying to make it so that ratelimit.h can get included by kernel.h or asm-generic/bug.h, just move the interface into ratelimit.h and make users have to include that. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/ratelimit.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 03ff67b0cdf5..2f007157fab9 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratelimit_state;
41extern int ___ratelimit(struct ratelimit_state *rs, const char *func); 41extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
42#define __ratelimit(state) ___ratelimit(state, __func__) 42#define __ratelimit(state) ___ratelimit(state, __func__)
43 43
44#ifdef CONFIG_PRINTK
45
46#define WARN_ON_RATELIMIT(condition, state) \
47 WARN_ON((condition) && __ratelimit(state))
48
49#define __WARN_RATELIMIT(condition, state, format...) \
50({ \
51 int rtn = 0; \
52 if (unlikely(__ratelimit(state))) \
53 rtn = WARN(condition, format); \
54 rtn; \
55})
56
57#define WARN_RATELIMIT(condition, format...) \
58({ \
59 static DEFINE_RATELIMIT_STATE(_rs, \
60 DEFAULT_RATELIMIT_INTERVAL, \
61 DEFAULT_RATELIMIT_BURST); \
62 __WARN_RATELIMIT(condition, &_rs, format); \
63})
64
65#else
66
67#define WARN_ON_RATELIMIT(condition, state) \
68 WARN_ON(condition)
69
70#define __WARN_RATELIMIT(condition, state, format...) \
71({ \
72 int rtn = WARN(condition, format); \
73 rtn; \
74})
75
76#define WARN_RATELIMIT(condition, format...) \
77({ \
78 int rtn = WARN(condition, format); \
79 rtn; \
80})
81
82#endif
83
44#endif /* _LINUX_RATELIMIT_H */ 84#endif /* _LINUX_RATELIMIT_H */