diff options
author | Joe Perches <joe@perches.com> | 2011-01-12 19:59:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 11:03:10 -0500 |
commit | 6ec42a56e258462cda510421aecc2680d3642e21 (patch) | |
tree | da167589365065ce7ec323a0d557f65737645771 /include | |
parent | ac83ed687837a44c6e46fb16411fb0d299fffd80 (diff) |
include/linux/printk.h: organize printk_ratelimited macros
- Use no_printk for !CONFIG_PRINTK printk_ratelimited.
- Whitespace cleanup.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/printk.h | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h index e96bd41491bd..d30f579c6f97 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -234,7 +234,8 @@ extern void dump_stack(void) __cold; | |||
234 | * no local ratelimit_state used in the !PRINTK case | 234 | * no local ratelimit_state used in the !PRINTK case |
235 | */ | 235 | */ |
236 | #ifdef CONFIG_PRINTK | 236 | #ifdef CONFIG_PRINTK |
237 | #define printk_ratelimited(fmt, ...) ({ \ | 237 | #define printk_ratelimited(fmt, ...) \ |
238 | ({ \ | ||
238 | static DEFINE_RATELIMIT_STATE(_rs, \ | 239 | static DEFINE_RATELIMIT_STATE(_rs, \ |
239 | DEFAULT_RATELIMIT_INTERVAL, \ | 240 | DEFAULT_RATELIMIT_INTERVAL, \ |
240 | DEFAULT_RATELIMIT_BURST); \ | 241 | DEFAULT_RATELIMIT_BURST); \ |
@@ -243,36 +244,34 @@ extern void dump_stack(void) __cold; | |||
243 | printk(fmt, ##__VA_ARGS__); \ | 244 | printk(fmt, ##__VA_ARGS__); \ |
244 | }) | 245 | }) |
245 | #else | 246 | #else |
246 | /* No effect, but we still get type checking even in the !PRINTK case: */ | 247 | #define printk_ratelimited(fmt, ...) \ |
247 | #define printk_ratelimited printk | 248 | no_printk(fmt, ##__VA_ARGS__) |
248 | #endif | 249 | #endif |
249 | 250 | ||
250 | #define pr_emerg_ratelimited(fmt, ...) \ | 251 | #define pr_emerg_ratelimited(fmt, ...) \ |
251 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) | 252 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
252 | #define pr_alert_ratelimited(fmt, ...) \ | 253 | #define pr_alert_ratelimited(fmt, ...) \ |
253 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) | 254 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
254 | #define pr_crit_ratelimited(fmt, ...) \ | 255 | #define pr_crit_ratelimited(fmt, ...) \ |
255 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) | 256 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
256 | #define pr_err_ratelimited(fmt, ...) \ | 257 | #define pr_err_ratelimited(fmt, ...) \ |
257 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) | 258 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
258 | #define pr_warning_ratelimited(fmt, ...) \ | 259 | #define pr_warn_ratelimited(fmt, ...) \ |
259 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | 260 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
260 | #define pr_warn_ratelimited pr_warning_ratelimited | 261 | #define pr_notice_ratelimited(fmt, ...) \ |
261 | #define pr_notice_ratelimited(fmt, ...) \ | ||
262 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) | 262 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
263 | #define pr_info_ratelimited(fmt, ...) \ | 263 | #define pr_info_ratelimited(fmt, ...) \ |
264 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) | 264 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
265 | /* no pr_cont_ratelimited, don't do that... */ | 265 | /* no pr_cont_ratelimited, don't do that... */ |
266 | /* If you are writing a driver, please use dev_dbg instead */ | 266 | /* If you are writing a driver, please use dev_dbg instead */ |
267 | #if defined(DEBUG) | 267 | #if defined(DEBUG) |
268 | #define pr_debug_ratelimited(fmt, ...) \ | 268 | #define pr_debug_ratelimited(fmt, ...) \ |
269 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 269 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
270 | #else | 270 | #else |
271 | #define pr_debug_ratelimited(fmt, ...) \ | 271 | #define pr_debug_ratelimited(fmt, ...) \ |
272 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 272 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
273 | #endif | 273 | #endif |
274 | 274 | ||
275 | |||
276 | enum { | 275 | enum { |
277 | DUMP_PREFIX_NONE, | 276 | DUMP_PREFIX_NONE, |
278 | DUMP_PREFIX_ADDRESS, | 277 | DUMP_PREFIX_ADDRESS, |