summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarkus Trippelsdorf <markus@trippelsdorf.de>2012-10-05 14:57:17 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-05 09:26:01 -0700
commit2351a6c6e7d5a5e848411b5dd2c02142497624cc (patch)
tree8acb375523fff8a24a23a75c9a64caa00124b835 /include
parent6f5601251d7e306b8a7bf5e674c5307d865c0fa1 (diff)
downloadlinux-2351a6c6e7d5a5e848411b5dd2c02142497624cc.tar.gz
linux-2351a6c6e7d5a5e848411b5dd2c02142497624cc.tar.xz
tty: Fix bogus "callbacks suppressed" messages
On the current git tree one sees messages such as: tty_init_dev: 24 callbacks suppressed tty_init_dev: 3 callbacks suppressed To fix this we need to look at condition before calling __ratelimit in the WARN_RATELIMIT macro. While at it remove the superfluous __WARN_RATELIMIT macros. Original patch is from Joe Perches and Jiri Slaby. Signed-off-by: Markus Trippelsdorf <markus@trippelsdorf.de> Acked-and-tested-by: Borislav Petkov <borislav.petkov@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ratelimit.h27
1 files changed, 9 insertions, 18 deletions
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index e11ccb4cf48d..0a260d8a18bf 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -46,20 +46,17 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#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...) \
+#define WARN_RATELIMIT(condition, format, ...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
- __WARN_RATELIMIT(condition, &_rs, format); \
+ int rtn = !!(condition); \
+ \
+ if (unlikely(rtn && __ratelimit(&_rs))) \
+ WARN(rtn, format, ##__VA_ARGS__); \
+ \
+ rtn; \
})
#else
@@ -67,15 +64,9 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#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...) \
+#define WARN_RATELIMIT(condition, format, ...) \
({ \
- int rtn = WARN(condition, format); \
+ int rtn = WARN(condition, format, ##__VA_ARGS__); \
rtn; \
})