]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 5 Apr 2009 17:23:25 +0000 (10:23 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 5 Apr 2009 17:23:25 +0000 (10:23 -0700)
* 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  printk: correct the behavior of printk_timed_ratelimit()
  vsprintf: unify the format decoding layer for its 3 users, cleanup
  fix regression from "vsprintf: unify the format decoding layer for its 3 users"
  vsprintf: fix bug in negative value printing
  vsprintf: unify the format decoding layer for its 3 users
  vsprintf: add binary printf
  printk: introduce printk_once()

Fix trivial conflicts (printk_once vs log_buf_kexec_setup() added near
each other) in include/linux/kernel.h.

1  2 
include/linux/kernel.h
include/linux/string.h
kernel/printk.c

diff --combined include/linux/kernel.h
index 556d781e69fe2220fd88696de68da014ae963d12,6e4406e12c6bc9b9353607450f9ddb564694a570..cff58e288a225bcd668a0dc482c00e62cb19c8a8
@@@ -242,7 -242,19 +242,20 @@@ 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);                      \
+       }                                       \
+ })
 +void log_buf_kexec_setup(void);
  #else
  static inline int vprintk(const char *s, va_list args)
        __attribute__ ((format (printf, 1, 0)));
@@@ -254,9 -266,10 +267,13 @@@ 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)
 +static inline void log_buf_kexec_setup(void)
 +{
 +}
  #endif
  
  extern int printk_needs_cpu(int cpu);
@@@ -357,8 -370,6 +374,8 @@@ static inline char *pack_hex_byte(char 
          printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
  #define pr_info(fmt, ...) \
          printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
 +#define pr_cont(fmt, ...) \
 +      printk(KERN_CONT fmt, ##__VA_ARGS__)
  
  /* If you are writing a driver, please use dev_dbg instead */
  #if defined(DEBUG)
        ((unsigned char *)&addr)[3]
  #define NIPQUAD_FMT "%u.%u.%u.%u"
  
 -#if defined(__LITTLE_ENDIAN)
 -#define HIPQUAD(addr) \
 -      ((unsigned char *)&addr)[3], \
 -      ((unsigned char *)&addr)[2], \
 -      ((unsigned char *)&addr)[1], \
 -      ((unsigned char *)&addr)[0]
 -#elif defined(__BIG_ENDIAN)
 -#define HIPQUAD       NIPQUAD
 -#else
 -#error "Please fix asm/byteorder.h"
 -#endif /* __LITTLE_ENDIAN */
 -
  /*
   * min()/max()/clamp() macros that also do
   * strict type-checking.. See the
diff --combined include/linux/string.h
index 8852739f36dfe94529ad3bdb09555741b0829b9e,27ac31784ad27196f5530f8f409724c1d5a75bee..3c877d686375022f9b69773465e8b80eb92ac864
  #include <linux/compiler.h>   /* for inline */
  #include <linux/types.h>      /* for size_t */
  #include <linux/stddef.h>     /* for NULL */
+ #include <stdarg.h>
  
  extern char *strndup_user(const char __user *, long);
 +extern void *memdup_user(const void __user *, size_t);
  
  /*
   * Include machine specific inline routines
@@@ -112,6 -112,12 +113,12 @@@ extern void argv_free(char **argv)
  
  extern bool sysfs_streq(const char *s1, const char *s2);
  
+ #ifdef CONFIG_BINARY_PRINTF
+ int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args);
+ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf);
+ int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
+ #endif
  extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
                        const void *from, size_t available);
  
diff --combined kernel/printk.c
index a5f61a9acedb3cfd72a7d87a29317f9f146d896d,2be719908d1f53a5ae99636ab2d70ebaa4b64405..5052b5497c67995f57c6b548b0b52c1989f4027b
@@@ -32,7 -32,6 +32,7 @@@
  #include <linux/security.h>
  #include <linux/bootmem.h>
  #include <linux/syscalls.h>
 +#include <linux/kexec.h>
  
  #include <asm/uaccess.h>
  
@@@ -136,24 -135,6 +136,24 @@@ static char *log_buf = __log_buf
  static int log_buf_len = __LOG_BUF_LEN;
  static unsigned logged_chars; /* Number of chars produced since last read+clear operation */
  
 +#ifdef CONFIG_KEXEC
 +/*
 + * This appends the listed symbols to /proc/vmcoreinfo
 + *
 + * /proc/vmcoreinfo is used by various utiilties, like crash and makedumpfile to
 + * obtain access to symbols that are otherwise very difficult to locate.  These
 + * symbols are specifically used so that utilities can access and extract the
 + * dmesg log from a vmcore file after a crash.
 + */
 +void log_buf_kexec_setup(void)
 +{
 +      VMCOREINFO_SYMBOL(log_buf);
 +      VMCOREINFO_SYMBOL(log_end);
 +      VMCOREINFO_SYMBOL(log_buf_len);
 +      VMCOREINFO_SYMBOL(logged_chars);
 +}
 +#endif
 +
  static int __init log_buf_len_setup(char *str)
  {
        unsigned size = memparse(str, &str);
@@@ -1311,8 -1292,11 +1311,11 @@@ EXPORT_SYMBOL(printk_ratelimit)
  bool printk_timed_ratelimit(unsigned long *caller_jiffies,
                        unsigned int interval_msecs)
  {
-       if (*caller_jiffies == 0 || time_after(jiffies, *caller_jiffies)) {
-               *caller_jiffies = jiffies + msecs_to_jiffies(interval_msecs);
+       if (*caller_jiffies == 0
+                       || !time_in_range(jiffies, *caller_jiffies,
+                                       *caller_jiffies
+                                       + msecs_to_jiffies(interval_msecs))) {
+               *caller_jiffies = jiffies;
                return true;
        }
        return false;