Skip to content

Commit

Permalink
WARN_ONCE(): use bool for boolean flag
Browse files Browse the repository at this point in the history
Commit 7086745 ("printk_once(): use bool
for boolean flag") changed printk_once() to use bool instead of int for
its guard variable.  Do the same change to WARN_ONCE() and WARN_ON_ONCE(),
for the same reasons.

This resulted in a reduction of 1462 bytes on a x86-64 defconfig:

   text    data     bss     dec     hex filename
8101271 1207116  992764 10301151         9d2edf vmlinux.before
8100553 1207148  991988 10299689         9d2929 vmlinux.after

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Cesar Eduardo Barros authored and Linus Torvalds committed Dec 15, 2009
1 parent 6613c5e commit 42f247c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/asm-generic/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,22 @@ extern void warn_slowpath_null(const char *file, const int line);
#endif

#define WARN_ON_ONCE(condition) ({ \
static int __warned; \
static bool __warned; \
int __ret_warn_once = !!(condition); \
\
if (unlikely(__ret_warn_once)) \
if (WARN_ON(!__warned)) \
__warned = 1; \
__warned = true; \
unlikely(__ret_warn_once); \
})

#define WARN_ONCE(condition, format...) ({ \
static int __warned; \
static bool __warned; \
int __ret_warn_once = !!(condition); \
\
if (unlikely(__ret_warn_once)) \
if (WARN(!__warned, format)) \
__warned = 1; \
__warned = true; \
unlikely(__ret_warn_once); \
})

Expand Down

0 comments on commit 42f247c

Please sign in to comment.