Staging: crystalhd: crystalhd_misc: improved debug macros

Improvement of debug macros to ensure safe use on if/else statements.

Signed-off-by: Jorgyano Vieira <jorgyano@gmail.com>
Acked-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jorgyano Vieira 2012-02-15 00:20:06 -02:00 committed by Greg Kroah-Hartman
parent 2140dc9ce7
commit 413db8c1c7
1 changed files with 22 additions and 18 deletions

View File

@ -203,26 +203,30 @@ enum _chd_log_levels {
BCMLOG_ENTER_LEAVE = 0x00000008, /* stack tracking */
};
#define BCMLOG_ENTER \
if (g_linklog_level & BCMLOG_ENTER_LEAVE) { \
printk(KERN_DEBUG "Entered %s\n", __func__); \
}
#define BCMLOG_ENTER \
do { \
if (g_linklog_level & BCMLOG_ENTER_LEAVE) \
printk(KERN_DEBUG "Entered %s\n", __func__); \
} while (0)
#define BCMLOG_LEAVE \
if (g_linklog_level & BCMLOG_ENTER_LEAVE) { \
printk(KERN_DEBUG "Leaving %s\n", __func__); \
}
#define BCMLOG_LEAVE \
do { \
if (g_linklog_level & BCMLOG_ENTER_LEAVE) \
printk(KERN_DEBUG "Leaving %s\n", __func__); \
} while (0) \
#define BCMLOG(trace, fmt, args...) \
if (g_linklog_level & trace) { \
printk(fmt, ##args); \
}
#define BCMLOG(trace, fmt, args...) \
do { \
if (g_linklog_level & trace) \
printk(fmt, ##args); \
} while (0)
#define BCMLOG_ERR(fmt, args...) \
do { \
if (g_linklog_level & BCMLOG_ERROR) { \
printk(KERN_ERR "*ERR*:%s:%d: "fmt, __FILE__, __LINE__, ##args); \
} \
} while (0);
#define BCMLOG_ERR(fmt, args...) \
do { \
if (g_linklog_level & BCMLOG_ERROR) \
printk(KERN_ERR "*ERR*:%s:%d: "fmt, \
__FILE__, __LINE__, ##args); \
} while (0)
#endif