[dahdi-commits] tzafrir: branch linux/tzafrir/sysfs r7346 - /linux/team/tzafrir/sysfs/drivers...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Oct 7 05:34:51 CDT 2009
Author: tzafrir
Date: Wed Oct 7 05:34:40 2009
New Revision: 7346
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7346
Log:
Resanme debug macros (no functional chane)
* Use lower-case names.
* Add dahdi_ as a prefix if none existed.
Modified:
linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c
linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c
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=7346&r1=7345&r2=7346
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c Wed Oct 7 05:34:40 2009
@@ -67,24 +67,33 @@
#endif
#define DBG_GENERAL BIT(0)
#define DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
-#define 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, ...) \
+#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, ...) \
+#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 DBG(bits, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && PRINTK(DEBUG, "-" #bits, "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define ERR(fmt, ...) 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__)
+#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 ----*/
@@ -138,7 +147,7 @@
BUG_ON(!dev);
chan = dev_to_chan(dev);
- CHAN_DBG(DEVICES, chan, "SYSFS\n");
+ chan_dbg(DEVICES, chan, "SYSFS\n");
//chan_remove(chan);
}
@@ -151,7 +160,7 @@
BUG_ON(!chan);
span = chan->span;
BUG_ON(!span);
- CHAN_DBG(DEVICES, chan, "SYSFS\n");
+ chan_dbg(DEVICES, chan, "SYSFS\n");
dev = &chan->chan_device;
dev->bus = &dahdi_chan_type;
dev->parent = &span->span_device;
@@ -160,7 +169,7 @@
dev->release = chan_release;
res = device_register(dev);
if(res) {
- CHAN_ERR(chan, "%s: device_register failed: %d\n", __func__, res);
+ chan_err(chan, "%s: device_register failed: %d\n", __func__, res);
return res;
}
// FIXME: reference counting.
@@ -172,7 +181,7 @@
{
struct device *dev = &chan->chan_device;
- CHAN_DBG(DEVICES, chan, "SYSFS\n");
+ chan_dbg(DEVICES, chan, "SYSFS\n");
dev = &chan->chan_device;
if(!dev_get_drvdata(dev))
return;
@@ -187,9 +196,9 @@
{
int res;
- DBG(DEVICES, "SYSFS\n");
+ dahdi_dbg(DEVICES, "SYSFS\n");
if((res = bus_register(&dahdi_chan_type)) < 0) {
- ERR("%s: bus_register(%s) failed. Error number %d",
+ dahdi_err("%s: bus_register(%s) failed. Error number %d",
__func__, dahdi_chan_type.name, res);
return res;
}
@@ -199,7 +208,7 @@
void dahdi_driver_chan_exit(void)
{
- DBG(DEVICES, "SYSFS\n");
+ dahdi_dbg(DEVICES, "SYSFS\n");
bus_unregister(&dahdi_chan_type);
}
EXPORT_SYMBOL(dahdi_driver_chan_exit);
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=7346&r1=7345&r2=7346
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c Wed Oct 7 05:34:40 2009
@@ -68,24 +68,33 @@
#endif
#define DBG_GENERAL BIT(0)
#define DBG_DEVICES BIT(7) /* instantiation/destruction etc. */
-#define 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, ...) \
+#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, ...) \
+#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 DBG(bits, fmt, ...) \
- ((void)((debug & (DBG_ ## bits)) && PRINTK(DEBUG, "-" #bits, "%s: " fmt, __func__, ## __VA_ARGS__)))
-#define ERR(fmt, ...) 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__)
+#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__)
char *initdir = "/usr/share/dahdi";
module_param(initdir, charp, 0644);
@@ -296,7 +305,7 @@
* to our bus */
static int span_match(struct device *dev, struct device_driver *driver)
{
- DBG(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
+ dahdi_dbg(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
dev_name(dev), driver->name);
return 1;
}
@@ -343,7 +352,7 @@
if(!dev)
return -ENODEV;
span = dev_to_span(dev);
- DBG(GENERAL, "SYFS dev_name=%s span=%s\n", dev_name(dev), span->name);
+ dahdi_dbg(GENERAL, "SYFS dev_name=%s span=%s\n", dev_name(dev), span->name);
SPAN_VAR_BLOCK;
envp[i] = NULL;
return 0;
@@ -364,7 +373,7 @@
if(!dev)
return -ENODEV;
span = dev_to_span(dev);
- DBG(GENERAL, "SYFS dev_name=%s span=%s\n", dev_name(dev), span->name);
+ dahdi_dbg(GENERAL, "SYFS dev_name=%s span=%s\n", dev_name(dev), span->name);
SPAN_VAR_BLOCK;
return 0;
}
@@ -408,7 +417,7 @@
struct kobject *kobj;
kobj = &span->span_device.kobj;
- SPAN_DBG(DEVICES, span, "SYFS dev_name=%s action=%d\n",
+ span_dbg(DEVICES, span, "SYFS dev_name=%s action=%d\n",
dev_name(&span->span_device), act);
#if defined(OLD_HOTPLUG_SUPPORT_269)
@@ -434,7 +443,7 @@
static void dahdi_release(struct device *dev)
{
- DBG(DEVICES, "SYSFS %s\n", dev_name(dev));
+ dahdi_dbg(DEVICES, "SYSFS %s\n", dev_name(dev));
}
static void span_release(struct device *dev)
@@ -473,7 +482,7 @@
struct dahdi_span *span;
span = dev_to_span(dev);
- SPAN_DBG(DEVICES, span, "SYSFS\n");
+ span_dbg(DEVICES, span, "SYSFS\n");
return 0;
}
@@ -482,7 +491,7 @@
struct dahdi_span *span;
span = dev_to_span(dev);
- SPAN_INFO(span, "[%s] Atribank Remove\n", span->name);
+ span_info(span, "[%s] Atribank Remove\n", span->name);
return 0;
}
@@ -516,7 +525,7 @@
for (i = 0; dev_attrs[i].attr.name != NULL; i++) {
res = device_create_file(device, &dev_attrs[i]);
if (res) {
- SPAN_ERR(span, "Failed registering attribute %s: %d\n",
+ span_err(span, "Failed registering attribute %s: %d\n",
dev_attrs[i].attr.name, res);
for (i--; i>=0; i--)
device_remove_file(device, &dev_attrs[i]);
@@ -546,7 +555,7 @@
int x;
BUG_ON(!span);
- SPAN_DBG(DEVICES, span, "\n");
+ span_dbg(DEVICES, span, "\n");
span_device = &span->span_device;
BUG_ON(!span_device);
for (x = 0; x < span->channels; x++) {
@@ -571,7 +580,7 @@
BUG_ON(!span);
span_device = &span->span_device;
BUG_ON(!span_device);
- SPAN_DBG(DEVICES, span, "\n");
+ span_dbg(DEVICES, span, "\n");
span_device->bus = &toplevel_bus_type;
span_device->parent = &toplevel_device;
dev_set_name(span_device, "span-%03d", span->spanno);
@@ -579,7 +588,7 @@
span_device->release = span_release;
res = device_register(span_device);
if(res) {
- SPAN_ERR(span, "%s: device_register failed: %d\n", __func__, res);
+ span_err(span, "%s: device_register failed: %d\n", __func__, res);
dev_set_drvdata(span_device, NULL);
return res;
}
@@ -591,9 +600,9 @@
struct dahdi_chan *chan = span->chans[x];
res = chan_device_register(chan);
if (res) {
- CHAN_ERR(chan, "Failed registering in sysfs: %d.\n",
+ chan_err(chan, "Failed registering in sysfs: %d.\n",
res);
- CHAN_ERR(chan, "And nobody wrote error handling yet.\n");
+ chan_err(chan, "And nobody wrote error handling yet.\n");
return res;
}
}
@@ -611,20 +620,20 @@
{
int res;
- DBG(DEVICES, "SYSFS\n");
+ dahdi_dbg(DEVICES, "SYSFS\n");
if((res = bus_register(&toplevel_bus_type)) < 0) {
- ERR("%s: bus_register(%s) failed. Error number %d",
+ dahdi_err("%s: bus_register(%s) failed. Error number %d",
__func__, toplevel_bus_type.name, res);
goto failed_bus;
}
dev_set_name(&toplevel_device, "dahdi");
if((res = device_register(&toplevel_device)) < 0) {
- ERR("%s: device_register(%s) failed. Error number %d",
+ dahdi_err("%s: device_register(%s) failed. Error number %d",
__func__, dev_name(&toplevel_device), res);
goto failed_busdevice;
}
if((res = driver_register(&span_driver)) < 0) {
- ERR("%s: driver_register(%s) failed. Error number %d",
+ dahdi_err("%s: driver_register(%s) failed. Error number %d",
__func__, span_driver.name, res);
goto failed_span_driver;
}
@@ -645,7 +654,7 @@
void dahdi_driver_exit(void)
{
- DBG(DEVICES, "SYSFS\n");
+ dahdi_dbg(DEVICES, "SYSFS\n");
dahdi_driver_chan_exit();
driver_unregister(&span_driver);
device_unregister(&toplevel_device);
More information about the dahdi-commits
mailing list