diff options
| author | OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> | 2010-05-24 17:33:11 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 11:07:03 -0400 |
| commit | d8521fcc5e0ad3e79bbc4231bb20a6cdc2b50164 (patch) | |
| tree | 7469b407cb8a87d26733cea33a1570c2433e014b /include/linux | |
| parent | fa1f68db6ca7ebb6fc4487ac215bffba06c01c28 (diff) | |
printk_ratelimited(): fix uninitialized spinlock
ratelimit_state initialization of printk_ratelimited() seems broken. This
fixes it by using DEFINE_RATELIMIT_STATE() to initialize spinlock
properly.
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kernel.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index ea8490d7020..05f332afc9e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -424,14 +424,13 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 424 | * no local ratelimit_state used in the !PRINTK case | 424 | * no local ratelimit_state used in the !PRINTK case |
| 425 | */ | 425 | */ |
| 426 | #ifdef CONFIG_PRINTK | 426 | #ifdef CONFIG_PRINTK |
| 427 | #define printk_ratelimited(fmt, ...) ({ \ | 427 | #define printk_ratelimited(fmt, ...) ({ \ |
| 428 | static struct ratelimit_state _rs = { \ | 428 | static DEFINE_RATELIMIT_STATE(_rs, \ |
| 429 | .interval = DEFAULT_RATELIMIT_INTERVAL, \ | 429 | DEFAULT_RATELIMIT_INTERVAL, \ |
| 430 | .burst = DEFAULT_RATELIMIT_BURST, \ | 430 | DEFAULT_RATELIMIT_BURST); \ |
| 431 | }; \ | 431 | \ |
| 432 | \ | 432 | if (__ratelimit(&_rs)) \ |
| 433 | if (__ratelimit(&_rs)) \ | 433 | printk(fmt, ##__VA_ARGS__); \ |
| 434 | printk(fmt, ##__VA_ARGS__); \ | ||
| 435 | }) | 434 | }) |
| 436 | #else | 435 | #else |
| 437 | /* No effect, but we still get type checking even in the !PRINTK case: */ | 436 | /* No effect, but we still get type checking even in the !PRINTK case: */ |
