On Tue, 2015-08-04 at 17:07 +0200, Jason A. Donenfeld wrote:
> The pr_debug family of functions turns into a no-op when -DDEBUG is not
> specified, opting instead to call "no_printk", which gets compiled to a
> no-op (but retains gcc's nice warnings about printf-style arguments).
[]
> diff --git a/include/linux/net.h b/include/linux/net.h
[]
> @@ -239,8 +239,14 @@ do {                                                     
>         \
>       net_ratelimited_function(pr_warn, fmt, ##__VA_ARGS__)
>  #define net_info_ratelimited(fmt, ...)                               \
>       net_ratelimited_function(pr_info, fmt, ##__VA_ARGS__)
> +#if defined(DEBUG)
>  #define net_dbg_ratelimited(fmt, ...)                                \
>       net_ratelimited_function(pr_debug, fmt, ##__VA_ARGS__)
> +#else
> +#define net_dbg_ratelimited(fmt, ...)                                \
> +     if (0)                                                  \
> +             no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
> +#endif

This should be:

#define net_dbg_ratelimited(fmt, ...)                           \
do {                                                            \
        if (0)                                                  \
                no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); \
} while (0)

to be safe in if/else uses


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to