Re: [RFC PATCH 2/4] x86, alternatives: Cleanup DPRINTK macro

Joe Perches
2015-01-05T17:16:49Z

On Mon, 2015-01-05 at 16:00 +0100, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> Make it pass __func__ implicitly. Also, dump info about each replacing
> we're doing. Fixup comments and style while at it.

It may be better to use dynamic debug functionality
directly with pr_debug instead of this __setup with
"debug-alternative".

It's becoming quite a bit more common to use the
#define macro(fmt, ...) style where you converted
back to the older #define macro(fmt, args...) style.

> diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
[]
> @@ -52,10 +52,10 @@ static int __init setup_noreplace_paravirt(char *str)
> __setup("noreplace-paravirt", setup_noreplace_paravirt);
> #endif
>
> -#define DPRINTK(fmt, ...) \
> -do { \
> - if (debug_alternative) \
> - printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
> +#define DPRINTK(fmt, args...) \
> +do { \
> + if (debug_alternative) \
> + printk(KERN_DEBUG "%s: " fmt "\n", __func__, ##args); \
> } while (0)