From f4fa1bcbf40df11759a7a37715e5f5ff9a1791ab Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Thu, 26 May 2011 15:00:31 -0400 Subject: [PATCH] --- yaml --- r: 252271 b: refs/heads/master c: 86e4ca66e81bba0f8640f1fa19b8b8f72cbd0561 h: refs/heads/master i: 252269: 40d9ffc5fedf15bb1678f05325fa87ecacf8090d 252267: 9bf2f5027499d42756ca83dc26d47a15f64d0953 252263: c3ef79f081d2d64480934ce47e7182f1d0c0f9ff 252255: 6b907d3a187ae8848c77f7935ed560f051948886 v: v3 --- [refs] | 2 +- trunk/include/asm-generic/bug.h | 40 --------------------------------- trunk/include/linux/ratelimit.h | 40 +++++++++++++++++++++++++++++++++ trunk/net/core/filter.c | 1 + 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/[refs] b/[refs] index 2bace79d67d0..a16eace604a3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 90e62474fd08e16ba5309886c801243b0eb782f3 +refs/heads/master: 86e4ca66e81bba0f8640f1fa19b8b8f72cbd0561 diff --git a/trunk/include/asm-generic/bug.h b/trunk/include/asm-generic/bug.h index 91784841e407..dfb0ec666c94 100644 --- a/trunk/include/asm-generic/bug.h +++ b/trunk/include/asm-generic/bug.h @@ -162,46 +162,6 @@ extern void warn_slowpath_null(const char *file, const int line); unlikely(__ret_warn_once); \ }) -#ifdef CONFIG_PRINTK - -#define WARN_ON_RATELIMIT(condition, state) \ - WARN_ON((condition) && __ratelimit(state)) - -#define __WARN_RATELIMIT(condition, state, format...) \ -({ \ - int rtn = 0; \ - if (unlikely(__ratelimit(state))) \ - rtn = WARN(condition, format); \ - rtn; \ -}) - -#define WARN_RATELIMIT(condition, format...) \ -({ \ - static DEFINE_RATELIMIT_STATE(_rs, \ - DEFAULT_RATELIMIT_INTERVAL, \ - DEFAULT_RATELIMIT_BURST); \ - __WARN_RATELIMIT(condition, &_rs, format); \ -}) - -#else - -#define WARN_ON_RATELIMIT(condition, state) \ - WARN_ON(condition) - -#define __WARN_RATELIMIT(condition, state, format...) \ -({ \ - int rtn = WARN(condition, format); \ - rtn; \ -}) - -#define WARN_RATELIMIT(condition, format...) \ -({ \ - int rtn = WARN(condition, format); \ - rtn; \ -}) - -#endif - /* * WARN_ON_SMP() is for cases that the warning is either * meaningless for !SMP or may even cause failures. diff --git a/trunk/include/linux/ratelimit.h b/trunk/include/linux/ratelimit.h index 03ff67b0cdf5..2f007157fab9 100644 --- a/trunk/include/linux/ratelimit.h +++ b/trunk/include/linux/ratelimit.h @@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratelimit_state; extern int ___ratelimit(struct ratelimit_state *rs, const char *func); #define __ratelimit(state) ___ratelimit(state, __func__) +#ifdef CONFIG_PRINTK + +#define WARN_ON_RATELIMIT(condition, state) \ + WARN_ON((condition) && __ratelimit(state)) + +#define __WARN_RATELIMIT(condition, state, format...) \ +({ \ + int rtn = 0; \ + if (unlikely(__ratelimit(state))) \ + rtn = WARN(condition, format); \ + rtn; \ +}) + +#define WARN_RATELIMIT(condition, format...) \ +({ \ + static DEFINE_RATELIMIT_STATE(_rs, \ + DEFAULT_RATELIMIT_INTERVAL, \ + DEFAULT_RATELIMIT_BURST); \ + __WARN_RATELIMIT(condition, &_rs, format); \ +}) + +#else + +#define WARN_ON_RATELIMIT(condition, state) \ + WARN_ON(condition) + +#define __WARN_RATELIMIT(condition, state, format...) \ +({ \ + int rtn = WARN(condition, format); \ + rtn; \ +}) + +#define WARN_RATELIMIT(condition, format...) \ +({ \ + int rtn = WARN(condition, format); \ + rtn; \ +}) + +#endif + #endif /* _LINUX_RATELIMIT_H */ diff --git a/trunk/net/core/filter.c b/trunk/net/core/filter.c index 0e3622f1dcb1..36f975fa87cb 100644 --- a/trunk/net/core/filter.c +++ b/trunk/net/core/filter.c @@ -38,6 +38,7 @@ #include #include #include +#include /* No hurry in this branch */ static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)