[dahdi-commits] tzafrir: branch linux/tzafrir/sysfs r7647 - in /linux/team/tzafrir/sysfs: dri...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Thu Nov 26 05:32:39 CST 2009
Author: tzafrir
Date: Thu Nov 26 05:32:37 2009
New Revision: 7647
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7647
Log:
Move printk macros to kernel.h
Move {dahdi,span,chan}_{dbg,info,warn,err} macros to kernel.h .
The dbg_* macros use the variable 'debug'. I opted to hilight that by
requiring to define DAHDI_PRINK_MACROS_USE_debug before including kernel.h
but I'm still not sure this is optimal.
Modified:
linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c
linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c
linux/team/tzafrir/sysfs/include/dahdi/kernel.h
Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c?view=diff&rev=7647&r1=7646&r2=7647
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c Thu Nov 26 05:32:37 2009
@@ -26,6 +26,7 @@
#endif
+#define DAHDI_PRINK_MACROS_USE_debug
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/errno.h>
@@ -62,40 +63,7 @@
static const char rcsid[] = "$Id$";
-/* Command line parameters */
extern int debug;
-#ifndef BIT /* added in 2.6.24 */
-#define BIT(i) (1UL << (i))
-#endif
-#define DBG_GENERAL BIT(0)
-#define DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
-#define DAHDI_PRINTK(level, category, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \
- THIS_MODULE->name, ## __VA_ARGS__)
-#define span_printk(level, category, span, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: span-%d: " fmt, #level, \
- category, THIS_MODULE->name, (span)->spanno, ## __VA_ARGS__)
-#define chan_printk(level, category, chan, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: %d: " fmt, #level, \
- category, THIS_MODULE->name, (chan)->channo, ## __VA_ARGS__)
-#define dahdi_dbg(bits, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && DAHDI_PRINTK(DEBUG, \
- "-" #bits, "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define dahdi_err(fmt, ...) DAHDI_PRINTK(ERR, "", fmt, ## __VA_ARGS__)
-#define span_dbg(bits, span, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && \
- span_printk(DEBUG, "-" #bits, span, "%s: " \
- fmt, __func__, ## __VA_ARGS__)))
-#define span_info(span, fmt, ...) span_printk(INFO, "", span, fmt, \
- ## __VA_ARGS__)
-#define span_err(span, fmt, ...) span_printk(ERR, "", span, fmt, \
- ## __VA_ARGS__)
-#define chan_dbg(bits, chan, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && \
- chan_printk(DEBUG, "-" #bits, chan, \
- "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define chan_err(chan, fmt, ...) chan_printk(ERR, "", chan, fmt, \
- ## __VA_ARGS__)
/*--------- Sysfs channel handling ----*/
Modified: linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=7647&r1=7646&r2=7647
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c Thu Nov 26 05:32:37 2009
@@ -26,6 +26,7 @@
#endif
+#define DAHDI_PRINK_MACROS_USE_debug
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/errno.h>
@@ -65,38 +66,6 @@
/* Command line parameters */
extern int debug;
-#ifndef BIT /* added in 2.6.24 */
-#define BIT(i) (1UL << (i))
-#endif
-#define DBG_GENERAL BIT(0)
-#define DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
-#define DAHDI_PRINTK(level, category, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \
- THIS_MODULE->name, ## __VA_ARGS__)
-#define span_printk(level, category, span, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: span-%d: " fmt, #level, \
- category, THIS_MODULE->name, (span)->spanno, ## __VA_ARGS__)
-#define chan_printk(level, category, chan, fmt, ...) \
- printk(KERN_ ## level "%s%s-%s: %d: " fmt, #level, \
- category, THIS_MODULE->name, (chan)->channo, ## __VA_ARGS__)
-#define dahdi_dbg(bits, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && DAHDI_PRINTK(DEBUG, \
- "-" #bits, "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define dahdi_err(fmt, ...) DAHDI_PRINTK(ERR, "", fmt, ## __VA_ARGS__)
-#define span_dbg(bits, span, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && \
- span_printk(DEBUG, "-" #bits, span, "%s: " \
- fmt, __func__, ## __VA_ARGS__)))
-#define span_info(span, fmt, ...) span_printk(INFO, "", span, fmt, \
- ## __VA_ARGS__)
-#define span_err(span, fmt, ...) span_printk(ERR, "", span, fmt, \
- ## __VA_ARGS__)
-#define chan_dbg(bits, chan, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && \
- chan_printk(DEBUG, "-" #bits, chan, \
- "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define chan_err(chan, fmt, ...) chan_printk(ERR, "", chan, fmt, \
- ## __VA_ARGS__)
static char *initdir = "/usr/share/dahdi";
module_param(initdir, charp, 0644);
Modified: linux/team/tzafrir/sysfs/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/tzafrir/sysfs/include/dahdi/kernel.h?view=diff&rev=7647&r1=7646&r2=7647
==============================================================================
--- linux/team/tzafrir/sysfs/include/dahdi/kernel.h (original)
+++ linux/team/tzafrir/sysfs/include/dahdi/kernel.h Thu Nov 26 05:32:37 2009
@@ -1196,4 +1196,47 @@
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
#endif
+/* prink-wrapper macros */
+#define DAHDI_PRINTK(level, category, fmt, ...) \
+ printk(KERN_ ## level "%s%s-%s: " fmt, #level, category, \
+ THIS_MODULE->name, ## __VA_ARGS__)
+#define span_printk(level, category, span, fmt, ...) \
+ printk(KERN_ ## level "%s%s-%s: span-%d: " fmt, #level, \
+ category, THIS_MODULE->name, (span)->spanno, ## __VA_ARGS__)
+#define chan_printk(level, category, chan, fmt, ...) \
+ printk(KERN_ ## level "%s%s-%s: %d: " fmt, #level, \
+ category, THIS_MODULE->name, (chan)->channo, ## __VA_ARGS__)
+#define dahdi_err(fmt, ...) DAHDI_PRINTK(ERR, "", fmt, ## __VA_ARGS__)
+#define span_info(span, fmt, ...) span_printk(INFO, "", span, fmt, \
+ ## __VA_ARGS__)
+#define span_err(span, fmt, ...) span_printk(ERR, "", span, fmt, \
+ ## __VA_ARGS__)
+#define chan_err(chan, fmt, ...) chan_printk(ERR, "", chan, fmt, \
+ ## __VA_ARGS__)
+
+/* The dbg_* ones use a magical variable 'debug' and the user should be
+ * aware of that.
+*/
+#ifdef DAHDI_PRINK_MACROS_USE_debug
+#ifndef BIT /* added in 2.6.24 */
+#define BIT(i) (1UL << (i))
+#endif
+/* Standard debug bit values. Any module may define others. They must
+ * be of the form DAHDI_DBG_*
+ */
+#define DAHDI_DBG_GENERAL BIT(0)
+#define DAHDI_DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
+#define dahdi_dbg(bits, fmt, ...) \
+ ((void)((debug & (DAHDI_DBG_ ## bits)) && DAHDI_PRINTK(DEBUG, \
+ "-" #bits, "%s: " fmt, __func__, ## __VA_ARGS__)))
+#define span_dbg(bits, span, fmt, ...) \
+ ((void)((debug & (DAHDI_DBG_ ## bits)) && \
+ span_printk(DEBUG, "-" #bits, span, "%s: " \
+ fmt, __func__, ## __VA_ARGS__)))
+#define chan_dbg(bits, chan, fmt, ...) \
+ ((void)((debug & (DAHDI_DBG_ ## bits)) && \
+ chan_printk(DEBUG, "-" #bits, chan, \
+ "%s: " fmt, __func__, ## __VA_ARGS__)))
+#endif /* DAHDI_PRINK_MACROS_USE_debug */
+
#endif /* _DAHDI_KERNEL_H */
More information about the dahdi-commits
mailing list