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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 12 Jun 2010 22:30:50 -0700
From:	Joe Perches <joe@...ches.com>
To:	Mark Rankilor <reodge@...il.com>
Cc:	devel@...verdev.osuosl.org,
	Henri Häkkinen <henuxd@...il.com>,
	gregkh@...e.de, andrea.gelmini@...ma.net,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging:comedi: Fixed coding convention issues.

On Sat, 2010-06-12 at 22:07 -0700, Joe Perches wrote:
> 2: Create some comedi logging functions or macros like:
>    	comedi_<level>(fmt, arg...) (ie: comedi_info, comedi_err, etc)
>    where "comedi:" is always prefixed and an
>    optional #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>    could be used.

Maybe this is a start:

Signed-off-by: Joe Perches <joe@...ches.com>
---
 drivers/staging/comedi/comedidev.h |   54 ++++++++++++++++++++++++++++++++++--
 1 files changed, 51 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index 4eb2b77..6c2bdde 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -43,11 +43,59 @@
 
 #include "comedi.h"
 
-#define DPRINTK(format, args...)	do {		\
-	if (comedi_debug)				\
-		printk(KERN_DEBUG "comedi: " format , ## args);	\
+#define comedi_printk(level, fmt, args...)			\
+	printk(level "comedi: " pr_fmt(fmt), ##args)
+
+#define DPRINTK(format, args...)				\
+do {								\
+	if (comedi_debug)					\
+		comedi_printk(KERN_DEBUG, fmt, ##args);		\
 } while (0)
 
+#define comedi_emerg(fmt, ...)				\
+	comedi_printk(KERN_EMERG, fmt, ##__VA_ARGS__)
+#define comedi_alert(fmt, ...)				\
+	comedi_printk(KERN_ALERT, fmt, ##__VA_ARGS__)
+#define comedi_crit(fmt, ...)				\
+	comedi_printk(KERN_CRIT, fmt, ##__VA_ARGS__)
+#define comedi_err(fmt, ...)				\
+	comedi_printk(KERN_ERR, fmt, ##__VA_ARGS__)
+#define comedi_warn(fmt, ...)				\
+	comedi_printk(KERN_WARNING, fmt, ##__VA_ARGS__)
+#define comedi_notice(fmt, ...)				\
+	comedi_printk(KERN_NOTICE, fmt, ##__VA_ARGS__)
+#define comedi_info(fmt, ...)				\
+	comedi_printk(KERN_INFO, fmt, ##__VA_ARGS__)
+
+/* comedi_devel() should produce zero code unless DEBUG is defined */
+#ifdef DEBUG
+#define comedi_devel(fmt, ...)				\
+	comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__)
+#else
+#define comedi_devel(fmt, ...)					\
+({								\
+	if (0)							\
+		comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__);	\
+	0;							\
+})
+#endif
+
+#if defined(DEBUG)
+#define comedi_debug(fmt, ...)				\
+	comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__)
+#elif defined(CONFIG_DYNAMIC_DEBUG)
+/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
+#define comedi_debug(fmt, ...)				\
+	dynamic_pr_debug(fmt, ##__VA_ARGS__)
+#else
+#define comedi_debug(fmt, ...)					\
+({								\
+	if (0)							\
+		comedi_printk(KERN_DEBUG, fmt, ##__VA_ARGS__);	\
+	0;							\
+})
+#endif
+
 #define COMEDI_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
 #define COMEDI_VERSION_CODE COMEDI_VERSION(COMEDI_MAJORVERSION, \
 	COMEDI_MINORVERSION, COMEDI_MICROVERSION)


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ