summaryrefslogtreecommitdiffstats
path: root/include/linux/arcdevice.h
diff options
context:
space:
mode:
authorJoe Perches2015-05-05 19:05:53 +0200
committerMichael Grzeschik2015-09-23 08:44:23 +0200
commitd77510f3436e0db9b5e72fa8159ce26c3ac88d2d (patch)
treec68e078467ff479e19c1a1de8ccd799c7d212463 /include/linux/arcdevice.h
parentarcnet: Use network block comment style (diff)
downloadkernel-qcow2-linux-d77510f3436e0db9b5e72fa8159ce26c3ac88d2d.tar.gz
kernel-qcow2-linux-d77510f3436e0db9b5e72fa8159ce26c3ac88d2d.tar.xz
kernel-qcow2-linux-d77510f3436e0db9b5e72fa8159ce26c3ac88d2d.zip
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>
Diffstat (limited to 'include/linux/arcdevice.h')
-rw-r--r--include/linux/arcdevice.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 78687885eb81..ad610208fbba 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -78,14 +78,24 @@
#endif
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 */
-#define BUGLVL(x) if ((ARCNET_DEBUG_MAX) & arcnet_debug & (x))
-#define BUGMSG2(x, msg, args...) do { BUGLVL(x) printk(msg, ## args); } while (0)
-#define BUGMSG(x, msg, args...) \
- BUGMSG2(x, "%s%6s: " msg, \
- x == D_NORMAL ? KERN_WARNING \
- : x < D_DURING ? KERN_INFO : KERN_DEBUG, \
- dev->name, ## args)
+#define BUGMSG(x, fmt, ...) \
+do { \
+ if (BUGLVL_TEST(x)) \
+ printk("%s%6s: " fmt, \
+ (x) == D_NORMAL ? KERN_WARNING : \
+ (x) < D_DURING ? KERN_INFO : KERN_DEBUG, \
+ 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 */
#define TIME(name, bytes, call) BUGLVL(D_TIMING) { \