diff options
author | Roland Dreier <rdreier@cisco.com> | 2009-09-22 19:43:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 10:39:29 -0400 |
commit | 70867453092297be9afb2249e712a1f960ec0a09 (patch) | |
tree | cf753b5467e3a93fafd6bb452292e6ec60c3de86 /include/linux/kernel.h | |
parent | 02b51df1b07b4e9ca823c89284e704cadb323cd1 (diff) |
printk_once(): use bool for boolean flag
Using the type bool (instead of int) for the __print_once flag in the
printk_once() macro matches the intent of the code better, and allows the
compiler to generate smaller code; eg a typical callsite with gcc 4.3.3 on
i386:
add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-6 (-6)
function old new delta
static.__print_once 4 1 -3
get_cpu_vendor 146 143 -3
Saving 6 bytes of object size per callsite by slightly improving the
readability of the source seems like a win to me.
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 0a2a19087863..55723afa097b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -252,10 +252,10 @@ extern int printk_delay_msec; | |||
252 | * Print a one-time message (analogous to WARN_ONCE() et al): | 252 | * Print a one-time message (analogous to WARN_ONCE() et al): |
253 | */ | 253 | */ |
254 | #define printk_once(x...) ({ \ | 254 | #define printk_once(x...) ({ \ |
255 | static int __print_once = 1; \ | 255 | static bool __print_once = true; \ |
256 | \ | 256 | \ |
257 | if (__print_once) { \ | 257 | if (__print_once) { \ |
258 | __print_once = 0; \ | 258 | __print_once = false; \ |
259 | printk(x); \ | 259 | printk(x); \ |
260 | } \ | 260 | } \ |
261 | }) | 261 | }) |