lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1442912534-10821-9-git-send-email-m.grzeschik@pengutronix.de>
Date:	Tue, 22 Sep 2015 11:01:49 +0200
From:	Michael Grzeschik <m.grzeschik@...gutronix.de>
To:	davem@...emloft.net
Cc:	netdev@...r.kernel.org, joe@...ches.com, kernel@...gutronix.de
Subject: [PATCH 08/33] arcnet: Neaten BUGMSG macro defines

From: Joe Perches <joe@...ches.com>

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@...ches.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@...gutronix.de>
---
 include/linux/arcdevice.h | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index 7868788..ad61020 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) {			\
-- 
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ