summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@systec-electronic.com>2016-03-17 11:00:20 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-04-08 13:33:18 +0200
commit97cef9084335959ad2e9d088d6d8adadf6c6e861 (patch)
tree7e275a38a177c9e9e2bc4885886337371792c631
parenteb36388c154a334322298f58328a6dfc7bf5567c (diff)
downloadbarebox-97cef9084335959ad2e9d088d6d8adadf6c6e861.tar.gz
barebox-97cef9084335959ad2e9d088d6d8adadf6c6e861.tar.xz
printk: Add printk_once
This is needed by upcoming list_sort implementation. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/printk.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/printk.h b/include/printk.h
index 822f64c61f..4b76ca10b2 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -92,6 +92,16 @@ static inline int pr_print(int level, const char *format, ...)
#define debug(fmt, arg...) __pr_printk(7, pr_fmt(fmt), ##arg)
#define pr_vdebug(fmt, arg...) __pr_printk(8, pr_fmt(fmt), ##arg)
+#define printk_once(fmt, ...) \
+({ \
+ static bool __print_once ; \
+ \
+ if (!__print_once) { \
+ __print_once = true; \
+ printk(fmt, ##__VA_ARGS__); \
+ } \
+})
+
struct log_entry {
struct list_head list;
char *msg;