diff options
author | Joel Stanley <joel@jms.id.au> | 2015-05-05 12:37:05 +0930 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-05-07 18:24:32 +1000 |
commit | 153a0a54873682dfbc434a897becfdee193a6cb6 (patch) | |
tree | c7d24fb8e0746e92b0b91aae46100c31f2fdac9c | |
parent | 4d78c68415f5ac3081b724628aee5e34e46a65b3 (diff) | |
download | skiboot-153a0a54873682dfbc434a897becfdee193a6cb6.zip skiboot-153a0a54873682dfbc434a897becfdee193a6cb6.tar.gz skiboot-153a0a54873682dfbc434a897becfdee193a6cb6.tar.bz2 |
Add prlog_once for logging a message only once
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | include/skiboot.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/skiboot.h b/include/skiboot.h index 2684c73..fd4d842 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 |