]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
printk: add print_hex_dump_devel()
authorThorsten Blum <thorsten.blum@linux.dev>
Thu, 19 Mar 2026 09:29:32 +0000 (10:29 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 27 Mar 2026 09:52:43 +0000 (18:52 +0900)
Add print_hex_dump_devel() as the hex dump equivalent of pr_devel(),
which emits output only when DEBUG is enabled, but keeps call sites
compiled otherwise.

Suggested-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/linux/printk.h

index 63d516c873b4c412eead6ee4eb9f90a5c28f630c..54e3c621fec37b83dd117d2b8daa495a28c471c3 100644 (file)
@@ -801,6 +801,19 @@ static inline void print_hex_dump_debug(const char *prefix_str, int prefix_type,
 }
 #endif
 
+#if defined(DEBUG)
+#define print_hex_dump_devel(prefix_str, prefix_type, rowsize,         \
+                            groupsize, buf, len, ascii)                \
+       print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, rowsize,    \
+                      groupsize, buf, len, ascii)
+#else
+static inline void print_hex_dump_devel(const char *prefix_str, int prefix_type,
+                                       int rowsize, int groupsize,
+                                       const void *buf, size_t len, bool ascii)
+{
+}
+#endif
+
 /**
  * print_hex_dump_bytes - shorthand form of print_hex_dump() with default params
  * @prefix_str: string to prefix each line with;