Commit e4c393fd authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* '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.
parents 0a053e8c 38a6ed3e
...@@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state; ...@@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state;
extern int printk_ratelimit(void); extern int printk_ratelimit(void);
extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
unsigned int interval_msec); 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); void log_buf_kexec_setup(void);
#else #else
static inline int vprintk(const char *s, va_list args) static inline int vprintk(const char *s, va_list args)
...@@ -254,6 +267,10 @@ static inline int printk_ratelimit(void) { return 0; } ...@@ -254,6 +267,10 @@ static inline int printk_ratelimit(void) { return 0; }
static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
unsigned int interval_msec) \ unsigned int interval_msec) \
{ return false; } { 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) static inline void log_buf_kexec_setup(void)
{ {
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/compiler.h> /* for inline */ #include <linux/compiler.h> /* for inline */
#include <linux/types.h> /* for size_t */ #include <linux/types.h> /* for size_t */
#include <linux/stddef.h> /* for NULL */ #include <linux/stddef.h> /* for NULL */
#include <stdarg.h>
extern char *strndup_user(const char __user *, long); extern char *strndup_user(const char __user *, long);
extern void *memdup_user(const void __user *, size_t); extern void *memdup_user(const void __user *, size_t);
...@@ -112,6 +113,12 @@ extern void argv_free(char **argv); ...@@ -112,6 +113,12 @@ extern void argv_free(char **argv);
extern bool sysfs_streq(const char *s1, const char *s2); 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, extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
const void *from, size_t available); const void *from, size_t available);
......
...@@ -1311,8 +1311,11 @@ EXPORT_SYMBOL(printk_ratelimit); ...@@ -1311,8 +1311,11 @@ EXPORT_SYMBOL(printk_ratelimit);
bool printk_timed_ratelimit(unsigned long *caller_jiffies, bool printk_timed_ratelimit(unsigned long *caller_jiffies,
unsigned int interval_msecs) unsigned int interval_msecs)
{ {
if (*caller_jiffies == 0 || time_after(jiffies, *caller_jiffies)) { if (*caller_jiffies == 0
*caller_jiffies = jiffies + msecs_to_jiffies(interval_msecs); || !time_in_range(jiffies, *caller_jiffies,
*caller_jiffies
+ msecs_to_jiffies(interval_msecs))) {
*caller_jiffies = jiffies;
return true; return true;
} }
return false; return false;
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# Library configuration # Library configuration
# #
config BINARY_PRINTF
def_bool n
menu "Library routines" menu "Library routines"
config BITREVERSE config BITREVERSE
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment