On Sunday, November 18, 2012 06:38:51 AM Joe Perches wrote:
> Another option could be testing __builtin_constant_p(prefix)

You mean something like below? Yes, it will work as well.

Pro: don't need to change existing code 
(drop [PATCH 2/2] dynamic_debug: use constant format in print_hex_dump_bytes())

Cons: format in dynamic metadata will be useless

What looks better?

---
#define dynamic_hex_dump(prefix_str, prefix_type, rowsize,      \
                         groupsize, buf, len, ascii)            \
do {                                                            \
        DEFINE_DYNAMIC_DEBUG_METADATA(descriptor,               \
                __builtin_constant_p(prefix_str) ? prefix_str : "hexdump");\
        if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT))  \
                print_hex_dump(KERN_DEBUG, prefix_str,          \
                               prefix_type, rowsize, groupsize, \
                               buf, len, ascii);                \
} while (0)



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to