summaryrefslogtreecommitdiffstats
path: root/include/printk.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2018-11-30 09:57:30 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2018-12-03 08:37:42 +0100
commit67a6c4417abf1904e9b415c939a2f501cb4216e0 (patch)
treef1e57d2d02919dff7c217b305bf8cee0b5557126 /include/printk.h
parent5f46b42be1c9856e37e3e4c4fb3c1b8489f9ea95 (diff)
downloadbarebox-67a6c4417abf1904e9b415c939a2f501cb4216e0.tar.gz
barebox-67a6c4417abf1904e9b415c939a2f501cb4216e0.tar.xz
Add pr_memory_display
pr_memory_display is a memory_display variant that takes a MSG_* loglevel priority with which the hexdump is printed. Like the normal pr_* function this is optimized out when the priority is below the compile time priority. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/printk.h')
-rw-r--r--include/printk.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/printk.h b/include/printk.h
index 4843dadd76..aaad07552e 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -105,6 +105,14 @@ static inline int pr_print(int level, const char *format, ...)
int memory_display(const void *addr, loff_t offs, unsigned nbytes, int size,
int swab);
+int __pr_memory_display(int level, const void *addr, loff_t offs, unsigned nbytes,
+ int size, int swab, const char *format, ...);
+
+#define pr_memory_display(level, addr, offs, nbytes, size, swab) \
+ ({ \
+ (level) <= LOGLEVEL ? __pr_memory_display((level), (addr), \
+ (offs), (nbytes), (size), (swab), pr_fmt("")) : 0; \
+ })
#define DUMP_PREFIX_OFFSET 0
static inline void print_hex_dump(const char *level, const char *prefix_str,