[PATCH 04/13] printk: Add printk_once

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is needed by upcoming list_sort implementation.

Signed-off-by: Alexander Stein <alexander.stein@xxxxxxxxxxxxxxxxxxxxx>
---
 include/printk.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/printk.h b/include/printk.h
index 822f64c..4b76ca1 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;
-- 
2.7.3


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux