summaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-03-06 19:45:42 +0300
committerIngo Molnar <mingo@elte.hu>2009-03-06 19:45:42 +0300
commit546e5354a6e4ec760ac03ef1148e9a4762abb5f5 (patch)
treeed9a867384f400f1270786e2cafa0d107ace6b75 /include/linux/kernel.h
parentaf438c0f114b6f731b923b5c07150f6159471502 (diff)
parentfef20d9c1380f04ba9492d6463148db07b413708 (diff)
downloadlinux-546e5354a6e4ec760ac03ef1148e9a4762abb5f5.tar.xz
Merge branch 'core/printk' into tracing/ftrace
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d4614a8a034b..7aef15c4645e 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state;
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)));
@@ -253,6 +266,10 @@ static inline int printk_ratelimit(void) { return 0; }
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);