Merge branch 'linus' into core/printk
authorIngo Molnar <mingo@elte.hu>
Tue, 17 Mar 2009 15:21:20 +0000 (16:21 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 17 Mar 2009 15:21:20 +0000 (16:21 +0100)
1  2 
include/linux/kernel.h

diff --combined 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