diff options
| author | Markus Trippelsdorf <markus@trippelsdorf.de> | 2012-10-05 08:57:17 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-05 12:26:01 -0400 |
| commit | 2351a6c6e7d5a5e848411b5dd2c02142497624cc (patch) | |
| tree | 8acb375523fff8a24a23a75c9a64caa00124b835 | |
| parent | 6f5601251d7e306b8a7bf5e674c5307d865c0fa1 (diff) | |
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>
| -rw-r--r-- | include/linux/ratelimit.h | 27 |
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); | |||
| 46 | #define WARN_ON_RATELIMIT(condition, state) \ | 46 | #define WARN_ON_RATELIMIT(condition, state) \ |
| 47 | WARN_ON((condition) && __ratelimit(state)) | 47 | WARN_ON((condition) && __ratelimit(state)) |
| 48 | 48 | ||
| 49 | #define __WARN_RATELIMIT(condition, state, format...) \ | 49 | #define WARN_RATELIMIT(condition, 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 | ({ \ | 50 | ({ \ |
| 59 | static DEFINE_RATELIMIT_STATE(_rs, \ | 51 | static DEFINE_RATELIMIT_STATE(_rs, \ |
| 60 | DEFAULT_RATELIMIT_INTERVAL, \ | 52 | DEFAULT_RATELIMIT_INTERVAL, \ |
| 61 | DEFAULT_RATELIMIT_BURST); \ | 53 | DEFAULT_RATELIMIT_BURST); \ |
| 62 | __WARN_RATELIMIT(condition, &_rs, format); \ | 54 | int rtn = !!(condition); \ |
| 55 | \ | ||
| 56 | if (unlikely(rtn && __ratelimit(&_rs))) \ | ||
| 57 | WARN(rtn, format, ##__VA_ARGS__); \ | ||
| 58 | \ | ||
| 59 | rtn; \ | ||
| 63 | }) | 60 | }) |
| 64 | 61 | ||
| 65 | #else | 62 | #else |
| @@ -67,15 +64,9 @@ extern int ___ratelimit(struct ratelimit_state *rs, const char *func); | |||
| 67 | #define WARN_ON_RATELIMIT(condition, state) \ | 64 | #define WARN_ON_RATELIMIT(condition, state) \ |
| 68 | WARN_ON(condition) | 65 | WARN_ON(condition) |
| 69 | 66 | ||
| 70 | #define __WARN_RATELIMIT(condition, state, format...) \ | 67 | #define WARN_RATELIMIT(condition, format, ...) \ |
| 71 | ({ \ | ||
| 72 | int rtn = WARN(condition, format); \ | ||
| 73 | rtn; \ | ||
| 74 | }) | ||
| 75 | |||
| 76 | #define WARN_RATELIMIT(condition, format...) \ | ||
| 77 | ({ \ | 68 | ({ \ |
| 78 | int rtn = WARN(condition, format); \ | 69 | int rtn = WARN(condition, format, ##__VA_ARGS__); \ |
| 79 | rtn; \ | 70 | rtn; \ |
| 80 | }) | 71 | }) |
| 81 | 72 | ||
