Re: [net-next PATCH 3/4] qlge: Reduce debug print output.

Joe Perches
2009-10-30T22:44:42Z

On Fri, 2009-10-30 at 15:13 -0700, Ron Mercer wrote:
> Signed-off-by: Ron Mercer <ron.mercer@qlogic.com>
[]
> diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
> index b9f65e0..502c3af 100644
> --- a/drivers/net/qlge/qlge.h
> +++ b/drivers/net/qlge/qlge.h
> @@ -27,6 +27,18 @@
> dev_printk(KERN_##klevel, &((qdev)->pdev->dev), \
> "%s: " fmt, __func__, ##args); \
> } while (0)
> +#if 0
> +#define QPRINTK_DBG(qdev, nlevel, klevel, fmt, args...) \
> + do { \
> + if (!((qdev)->msg_enable & NETIF_MSG_##nlevel)) \
> + ; \
> + else \
> + dev_printk(KERN_##klevel, &((qdev)->pdev->dev), \
> + "%s: " fmt, __func__, ##args); \
> + } while (0)
> +#else
> +#define QPRINTK_DBG(qdev, nlevel, klevel, fmt, args...)
> +#endif

This uses an inverted test and it doesn't verify the args to
dev_printk when not #defined.

How about:

#ifdef DEBUG
#define QPRINTK_DBG(qdev, nlevel, klevel, fmt, args...) do { \
if ((qdev)->msg_enable & NETIF_MSG_##nlevel) \
dev_printk(KERN_##klevel, &((qdev)->pdev->dev), \
"%s: " fmt, __func__, ##args); \
} while (0)
#else
#define QPRINTK_DBG(qdev, nlevel, klevel, fmt, args...) do { \
if (0 && (qdev)->msg_enable & NETIF_MSG_##nlevel) \
dev_printk(KERN_##klevel, &((qdev)->pdev->dev), \
"%s: " fmt, __func__, ##args); \
} while (0)
#endif