Re: [tip:x86/debug] printk: Make the printk*once() variants return a value

From: Joe Perches
Date: Fri Jul 08 2016 - 22:41:17 EST


On Fri, 2016-07-08 at 05:08 -0700, tip-bot for Borislav Petkov wrote:
> printk: Make the printk*once() variants return a value
[]
> diff --git a/include/linux/printk.h b/include/linux/printk.h
[]
> @@ -108,11 +108,14 @@ struct va_format {
>   * Dummy printk for disabled debugging statements to use whilst maintaining
>   * gcc's format checking.
>   */
> -#define no_printk(fmt, ...) \
> -do { \
> - if (0) \
> - printk(fmt, ##__VA_ARGS__); \
> -} while (0)
> +#define no_printk(fmt, ...) \
> +({ \
> + do { \
> + if (0) \
> + printk(fmt, ##__VA_ARGS__); \
> + } while (0); \
> + 0; \
> +})

This change isn't described in the commit message and there
doesn't seem to be a need to change this.

And as statement expressions these no longer need
"do { <foo> } while (0)" this could have been be simplified to

#define no_printk(fmt, ...)
({
if (0)
printk(fmt, ##__VA_ARGS__);
})