Re: [RFC] dynamic_debug: introduce debug_hex_dump()

From: Vladimir Kondratiev
Date: Sun Nov 18 2012 - 12:03:17 EST


On Sunday, November 18, 2012 05:43:07 PM Vladimir Kondratiev wrote:
> 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)

In case this option wins, patch follows. There is no need for
2-nd one to fix existing drivers.