[Skiboot] [PATCH v2 1/2] Add prlog_once for logging a message only once
Joel Stanley
joel at jms.id.au
Tue May 5 13:07:05 AEST 2015
Signed-off-by: Joel Stanley <joel at jms.id.au>
---
include/skiboot.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/skiboot.h b/include/skiboot.h
index fc5bc1d..a85df08 100644
--- a/include/skiboot.h
+++ b/include/skiboot.h
@@ -94,6 +94,14 @@ extern struct debug_descriptor debug_descriptor;
#define PR_INSANE 9
void prlog(int log_level, const char* fmt, ...) __attribute__((format (printf, 2, 3)));
#define prerror(fmt...) do { prlog(PR_ERR, fmt); } while(0)
+#define prlog_once(arg, ...) \
+({ \
+ static bool __prlog_once = false; \
+ if (!__prlog_once) { \
+ __prlog_once = true; \
+ prlog(arg, ##__VA_ARGS__); \
+ } \
+})
/* Location codes -- at most 80 chars with null termination */
#define LOC_CODE_SIZE 80
--
2.1.4
More information about the Skiboot
mailing list