mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-09 20:14:09 +08:00
arcnet: Neaten BUGMSG macro defines
These macros are actually printk and pr_cont uses with a flag. Add a new BUGLVL_TEST macro which is just the "should use" test and not an odd "if (<foo>)" macro to simplify uses in a new patch. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
This commit is contained in:
parent
f2f0a16bf8
commit
d77510f343
@ -78,14 +78,24 @@
|
|||||||
#endif
|
#endif
|
||||||
extern int arcnet_debug;
|
extern int arcnet_debug;
|
||||||
|
|
||||||
|
#define BUGLVL_TEST(x) ((x) & ARCNET_DEBUG_MAX & arcnet_debug)
|
||||||
|
#define BUGLVL(x) if (BUGLVL_TEST(x))
|
||||||
|
|
||||||
/* macros to simplify debug checking */
|
/* macros to simplify debug checking */
|
||||||
#define BUGLVL(x) if ((ARCNET_DEBUG_MAX) & arcnet_debug & (x))
|
#define BUGMSG(x, fmt, ...) \
|
||||||
#define BUGMSG2(x, msg, args...) do { BUGLVL(x) printk(msg, ## args); } while (0)
|
do { \
|
||||||
#define BUGMSG(x, msg, args...) \
|
if (BUGLVL_TEST(x)) \
|
||||||
BUGMSG2(x, "%s%6s: " msg, \
|
printk("%s%6s: " fmt, \
|
||||||
x == D_NORMAL ? KERN_WARNING \
|
(x) == D_NORMAL ? KERN_WARNING : \
|
||||||
: x < D_DURING ? KERN_INFO : KERN_DEBUG, \
|
(x) < D_DURING ? KERN_INFO : KERN_DEBUG, \
|
||||||
dev->name, ## args)
|
dev->name, ##__VA_ARGS__); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define BUGMSG2(x, fmt, ...) \
|
||||||
|
do { \
|
||||||
|
if (BUGLVL_TEST(x)) \
|
||||||
|
printk(fmt, ##__VA_ARGS__); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/* see how long a function call takes to run, expressed in CPU cycles */
|
/* see how long a function call takes to run, expressed in CPU cycles */
|
||||||
#define TIME(name, bytes, call) BUGLVL(D_TIMING) { \
|
#define TIME(name, bytes, call) BUGLVL(D_TIMING) { \
|
||||||
|
Loading…
Reference in New Issue
Block a user