Commit 6ec42a56 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds

include/linux/printk.h: organize printk_ratelimited macros

- Use no_printk for !CONFIG_PRINTK printk_ratelimited.

- Whitespace cleanup.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent ac83ed68
...@@ -234,7 +234,8 @@ extern void dump_stack(void) __cold; ...@@ -234,7 +234,8 @@ extern void dump_stack(void) __cold;
* no local ratelimit_state used in the !PRINTK case * no local ratelimit_state used in the !PRINTK case
*/ */
#ifdef CONFIG_PRINTK #ifdef CONFIG_PRINTK
#define printk_ratelimited(fmt, ...) ({ \ #define printk_ratelimited(fmt, ...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \ static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \ DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \ DEFAULT_RATELIMIT_BURST); \
...@@ -243,8 +244,8 @@ extern void dump_stack(void) __cold; ...@@ -243,8 +244,8 @@ extern void dump_stack(void) __cold;
printk(fmt, ##__VA_ARGS__); \ printk(fmt, ##__VA_ARGS__); \
}) })
#else #else
/* No effect, but we still get type checking even in the !PRINTK case: */ #define printk_ratelimited(fmt, ...) \
#define printk_ratelimited printk no_printk(fmt, ##__VA_ARGS__)
#endif #endif
#define pr_emerg_ratelimited(fmt, ...) \ #define pr_emerg_ratelimited(fmt, ...) \
...@@ -255,9 +256,8 @@ extern void dump_stack(void) __cold; ...@@ -255,9 +256,8 @@ extern void dump_stack(void) __cold;
printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
#define pr_err_ratelimited(fmt, ...) \ #define pr_err_ratelimited(fmt, ...) \
printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warning_ratelimited(fmt, ...) \ #define pr_warn_ratelimited(fmt, ...) \
printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
#define pr_warn_ratelimited pr_warning_ratelimited
#define pr_notice_ratelimited(fmt, ...) \ #define pr_notice_ratelimited(fmt, ...) \
printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
#define pr_info_ratelimited(fmt, ...) \ #define pr_info_ratelimited(fmt, ...) \
...@@ -272,7 +272,6 @@ extern void dump_stack(void) __cold; ...@@ -272,7 +272,6 @@ extern void dump_stack(void) __cold;
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif #endif
enum { enum {
DUMP_PREFIX_NONE, DUMP_PREFIX_NONE,
DUMP_PREFIX_ADDRESS, DUMP_PREFIX_ADDRESS,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment