From: Ingo Molnar Date: Tue, 17 Mar 2009 15:21:20 +0000 (+0100) Subject: Merge branch 'linus' into core/printk X-Git-Tag: v2.6.30-rc1~208^2~2 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fcifs-2.6.git;a=commitdiff_plain;h=47239561e39bceefecc3cd67f71fcf86a198a8ff;hp=-c Merge branch 'linus' into core/printk --- 47239561e39bceefecc3cd67f71fcf86a198a8ff diff --combined include/linux/kernel.h index 3c183d9864ae,7fa371898e3e..2755165bb291 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@@ -242,19 -242,6 +242,19 @@@ extern struct ratelimit_state printk_ra extern int printk_ratelimit(void); extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, unsigned int interval_msec); + +/* + * Print a one-time message (analogous to WARN_ONCE() et al): + */ +#define printk_once(x...) ({ \ + static int __print_once = 1; \ + \ + if (__print_once) { \ + __print_once = 0; \ + printk(x); \ + } \ +}) + #else static inline int vprintk(const char *s, va_list args) __attribute__ ((format (printf, 1, 0))); @@@ -266,10 -253,6 +266,10 @@@ static inline int printk_ratelimit(void static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ unsigned int interval_msec) \ { return false; } + +/* No effect, but we still get type checking even in the !PRINTK case: */ +#define printk_once(x...) printk(x) + #endif extern int printk_needs_cpu(int cpu); @@@ -497,7 -480,8 +497,8 @@@ static inline char *pack_hex_byte(char /* * swap - swap value of @a and @b */ - #define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; }) + #define swap(a, b) \ + do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) /** * container_of - cast a member of a structure out to the containing structure