Subject: Re: [PATCH 2/7] CAN: Add PF_CAN core module

From: Joe Perches <[email-masked]>
Date: Thu, 15 Nov 2007 00:04:20 -0800

On Thu, 2007-11-15 at 08:40 +0100, Oliver Hartkopp wrote:
> Stephen Hemminger wrote:
> >> +#ifdef CONFIG_CAN_DEBUG_CORE
> >> +extern void can_debug_skb(struct sk_buff *skb);
> >> +extern void can_debug_cframe(const char *msg, struct can_frame *cframe);
> >> +#define DBG(fmt, args...)  (DBG_VAR & 1 ? printk( \
> >> +					KERN_DEBUG DBG_PREFIX ": %s: " fmt, \
> >> +					__func__, ##args) : 0)
> >> +#define DBG_FRAME(fmt, cf) (DBG_VAR & 2 ? can_debug_cframe(fmt, cf) : 0)
> >> +#define DBG_SKB(skb)       (DBG_VAR & 4 ? can_debug_skb(skb) : 0)
> >> +#else
> >> +#define DBG(fmt, args...)
> >> +#define DBG_FRAME(fmt, cf)
> >> +#define DBG_SKB(skb)
> >> +#endif

I would prefer the more frequently used macro style:

#define DBG(fmt, args...) \
	do { if (DBG_VAR & 1) printk(KERN_DEBUG DBG_PREFIX ": %s: " fmt, \
				     __func__, ##args); } while (0)

#define DBG_FRAME(fmt, cf) \
	do { if (DBG_VAR & 2) can_debug_cframe(fmt, cf); } while (0)

#define DBG_SKB(skb) \
	do { if (DBG_VAR & 4) can_debug_skb(skb); } while (0)