[svn-commits] tzafrir: branch linux/tzafrir/sysfs r7646 - /linux/team/tzafrir/sysfs/drivers...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Nov 25 12:50:07 CST 2009
Author: tzafrir
Date: Wed Nov 25 12:50:06 2009
New Revision: 7646
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7646
Log:
coding style cleanup. No functional change.
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=7646&r1=7645&r2=7646
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs-chan.c Wed Nov 25 12:50:06 2009
@@ -1,6 +1,6 @@
/*
* Written by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
- * Copyright (C) 2008, Xorcom
+ * Copyright (C) 2008-2009, Xorcom
*
* All rights reserved.
*
@@ -21,7 +21,7 @@
*/
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
# warning "This module is tested only with 2.6 kernels"
#endif
@@ -31,30 +31,32 @@
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h>
-//#include <linux/device.h>
#include <linux/delay.h> /* for msleep() to debug */
#include <dahdi/kernel.h>
/*
* Hotplug replaced with uevent in 2.6.16
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-#define OLD_HOTPLUG_SUPPORT // for older kernels
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
-#define DEVICE_ATTR_READER(name,dev,buf) \
- ssize_t name(struct device *dev, struct device_attribute *attr, char *buf)
-#define DEVICE_ATTR_WRITER(name,dev,buf, count) \
- ssize_t name(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-#define BUS_ATTR_READER(name,dev,buf) \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
+#define OLD_HOTPLUG_SUPPORT /* for older kernels */
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
+#define DEVICE_ATTR_READER(name, dev, buf) \
+ ssize_t name(struct device *dev, \
+ struct device_attribute *attr, char *buf)
+#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
+ ssize_t name(struct device *dev, \
+ struct device_attribute *attr, \
+ const char *buf, size_t count)
+#define BUS_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, struct device_attribute *attr, char *buf)
#else
-#define DEVICE_ATTR_READER(name,dev,buf) \
+#define DEVICE_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, char *buf)
-#define DEVICE_ATTR_WRITER(name,dev,buf, count) \
+#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
ssize_t name(struct device *dev, const char *buf, size_t count)
-#define BUS_ATTR_READER(name,dev,buf) \
+#define BUS_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, char *buf)
#endif
@@ -98,13 +100,13 @@
/*--------- Sysfs channel handling ----*/
-#define chan_attr(field, format_string) \
-static BUS_ATTR_READER(field##_show,dev,buf) \
-{ \
- struct dahdi_chan *chan; \
- \
- chan = dev_to_chan(dev); \
- return sprintf (buf, format_string, chan->field); \
+#define chan_attr(field, format_string) \
+static BUS_ATTR_READER(field##_show, dev, buf) \
+{ \
+ struct dahdi_chan *chan; \
+ \
+ chan = dev_to_chan(dev); \
+ return sprintf(buf, format_string, chan->field); \
}
chan_attr(name, "%s\n");
@@ -118,14 +120,14 @@
#endif
static struct device_attribute chan_dev_attrs[] = {
- __ATTR_RO(name),
- __ATTR_RO(channo),
- __ATTR_RO(sig),
- __ATTR_RO(sigcap),
- __ATTR_RO(chan_alarms),
- __ATTR_RO(blocksize),
+ __ATTR_RO(name),
+ __ATTR_RO(channo),
+ __ATTR_RO(sig),
+ __ATTR_RO(sigcap),
+ __ATTR_RO(chan_alarms),
+ __ATTR_RO(blocksize),
#ifdef OPTIMIZE_CHANMUTE
- __ATTR_RO(chanmute),
+ __ATTR_RO(chanmute),
#endif
__ATTR_NULL,
};
@@ -139,7 +141,6 @@
BUG_ON(!dev);
chan = dev_to_chan(dev);
chan_dbg(DEVICES, chan, "SYSFS\n");
- //chan_remove(chan);
}
int chan_device_register(struct dahdi_chan *chan)
@@ -159,12 +160,11 @@
dev_set_drvdata(dev, chan);
dev->release = chan_release;
res = device_register(dev);
- if(res) {
- chan_err(chan, "%s: device_register failed: %d\n", __func__, res);
+ if (res) {
+ chan_err(chan, "%s: device_register failed: %d\n",
+ __func__, res);
return res;
}
- // FIXME: reference counting.
- //get_xpd(__func__, xpd);
return 0;
}
@@ -174,7 +174,7 @@
chan_dbg(DEVICES, chan, "SYSFS\n");
dev = &chan->chan_device;
- if(!dev_get_drvdata(dev))
+ if (!dev_get_drvdata(dev))
return;
BUG_ON(dev_get_drvdata(dev) != chan);
device_unregister(dev);
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=7646&r1=7645&r2=7646
==============================================================================
--- linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/team/tzafrir/sysfs/drivers/dahdi/dahdi-sysfs.c Wed Nov 25 12:50:06 2009
@@ -1,6 +1,6 @@
/*
- * Written by Oron Peled <oron at actcom.co.il>
- * Copyright (C) 2004-2006, Xorcom
+ * Written by Tzafrir Cohen <tzafrir.cohen at xorcom.com>
+ * Copyright (C) 2008-2009, Xorcom
*
* All rights reserved.
*
@@ -21,7 +21,7 @@
*/
#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
# warning "This module is tested only with 2.6 kernels"
#endif
@@ -31,7 +31,6 @@
#include <linux/errno.h>
#include <linux/proc_fs.h>
#include <linux/workqueue.h>
-//#include <linux/device.h>
#include <linux/delay.h> /* for msleep() to debug */
#include <dahdi/kernel.h>
#include "dahdi-sysfs.h"
@@ -39,23 +38,26 @@
/*
* Hotplug replaced with uevent in 2.6.16
*/
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-#define OLD_HOTPLUG_SUPPORT // for older kernels
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
-#define DEVICE_ATTR_READER(name,dev,buf) \
- ssize_t name(struct device *dev, struct device_attribute *attr, char *buf)
-#define DEVICE_ATTR_WRITER(name,dev,buf, count) \
- ssize_t name(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-#define BUS_ATTR_READER(name,dev,buf) \
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16)
+#define OLD_HOTPLUG_SUPPORT /* for older kernels */
+#endif
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 14)
+#define DEVICE_ATTR_READER(name, dev, buf) \
+ ssize_t name(struct device *dev, \
+ struct device_attribute *attr, char *buf)
+#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
+ ssize_t name(struct device *dev, \
+ struct device_attribute *attr, \
+ const char *buf, size_t count)
+#define BUS_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, struct device_attribute *attr, char *buf)
#else
-#define DEVICE_ATTR_READER(name,dev,buf) \
+#define DEVICE_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, char *buf)
-#define DEVICE_ATTR_WRITER(name,dev,buf, count) \
+#define DEVICE_ATTR_WRITER(name, dev, buf, count) \
ssize_t name(struct device *dev, const char *buf, size_t count)
-#define BUS_ATTR_READER(name,dev,buf) \
+#define BUS_ATTR_READER(name, dev, buf) \
ssize_t name(struct device *dev, char *buf)
#endif
@@ -96,159 +98,17 @@
#define chan_err(chan, fmt, ...) chan_printk(ERR, "", chan, fmt, \
## __VA_ARGS__)
-char *initdir = "/usr/share/dahdi";
+static char *initdir = "/usr/share/dahdi";
module_param(initdir, charp, 0644);
-/*--------- Sysfs Bus handling ----*/
-#if 0
-static DEVICE_ATTR_READER(span_state_show, dev, buf)
-{
- struct dahdi_span *span;
- int res;
-
- span = dev_to_span(dev);
- res = XBUS_STATE(span);
- res = snprintf(buf, PAGE_SIZE, "%s (%d)\n",
- xbus_statename(res), res);
- return res;
-}
-
-static DEVICE_ATTR_WRITER(xbus_state_store, dev, buf, count)
-{
- xbus_t *xbus;
-
- xbus = dev_to_xbus(dev);
- XBUS_DBG(GENERAL, xbus, "%s\n", buf);
- if(strncmp(buf, "stop", 4) == 0)
- xbus_deactivate(xbus, 0);
- else if(XBUS_IS(xbus, IDLE) && strncmp(buf, "start", 5) == 0)
- xbus_activate(xbus);
- else {
- XBUS_NOTICE(xbus, "%s: Illegal action %s in state %s. Ignored.\n",
- __func__, buf,
- xbus_statename(XBUS_STATE(xbus)));
- return -EINVAL;
- }
- return count;
-}
-
-static DEVICE_ATTR_READER(status_show, dev, buf)
-{
- xbus_t *xbus;
- int res;
-
- xbus = dev_to_xbus(dev);
- res = snprintf(buf, PAGE_SIZE, "%s\n", (!XBUS_IS(xbus, DISCONNECTED))?"connected":"missing");
- return res;
-}
-
-static DEVICE_ATTR_READER(timing_show, dev, buf)
-{
- xbus_t *xbus;
- struct xpp_drift *driftinfo;
- int len = 0;
- struct timeval now;
-
- do_gettimeofday(&now);
- xbus = dev_to_xbus(dev);
- driftinfo = &xbus->drift;
- len += snprintf(buf + len, PAGE_SIZE - len, "DRIFT: %-3s", sync_mode_name(xbus->sync_mode));
- if(xbus->sync_mode == SYNC_MODE_PLL) {
- len += snprintf(buf + len, PAGE_SIZE - len,
- " %5d: jitter %4d median %4d calc_drift %3d lost (%4d,%4d) : ",
- xbus->ticker.cycle,
- driftinfo->jitter, driftinfo->median,
- driftinfo->calc_drift,
- driftinfo->lost_ticks, driftinfo->lost_tick_count);
- len += snprintf(buf + len, PAGE_SIZE - len,
- "DRIFT %3d %ld sec ago",
- xbus->sync_adjustment,
- (xbus->pll_updated_at == 0) ? 0 : now.tv_sec - xbus->pll_updated_at);
- }
- len += snprintf(buf + len, PAGE_SIZE - len, "\n");
- return len;
-}
-
-#ifdef SAMPLE_TICKS
-/*
- * tick sampling: Measure offset from reference ticker:
- * - Recording start when writing to:
- * /sys/bus/astribanks/devices/xbus-??/samples
- * - Recording ends when filling SAMPLE_SIZE ticks
- * - Results are read from the same sysfs file.
- * - Trying to read/write during recording, returns -EBUSY.
- */
-static DEVICE_ATTR_READER(samples_show, dev, buf)
-{
- xbus_t *xbus;
- int len = 0;
- int i;
-
- xbus = dev_to_xbus(dev);
- if(xbus->sample_running)
- return -EBUSY;
- for(i = 0; i < SAMPLE_SIZE; i++) {
- if(len > PAGE_SIZE - 20)
- break;
- len += snprintf(buf + len, PAGE_SIZE - len, "%d\n", xbus->sample_ticks[i]);
- }
- return len;
-}
-
-static DEVICE_ATTR_WRITER(samples_store, dev, buf, count)
-{
- xbus_t *xbus;
-
- xbus = dev_to_xbus(dev);
- if(xbus->sample_running)
- return -EBUSY;
- memset(xbus->sample_ticks, 0, sizeof(*xbus->sample_ticks));
- xbus->sample_pos = 0;
- xbus->sample_running = 1;
- return count;
-}
-#endif
-
-/*
- * Clear statistics
- */
-static DEVICE_ATTR_WRITER(cls_store, dev, buf, count)
-{
- xbus_t *xbus;
- struct xpp_drift *driftinfo;
-
- xbus = dev_to_xbus(dev);
- driftinfo = &xbus->drift;
- driftinfo->lost_ticks = 0;
- driftinfo->lost_tick_count = 0;
- xbus->min_tx_sync = INT_MAX;
- xbus->max_tx_sync = 0;
- xbus->min_rx_sync = INT_MAX;
- xbus->max_rx_sync = 0;
-#ifdef SAMPLE_TICKS
- memset(xbus->sample_ticks, 0, sizeof(*xbus->sample_ticks));
-#endif
- return count;
-}
-
-static DEVICE_ATTR_READER(waitfor_xpds_show, dev, buf)
-{
- xbus_t *xbus;
- int len;
-
- xbus = dev_to_xbus(dev);
- len = waitfor_xpds(xbus, buf);
- return len;
-}
-#endif
-
-#define span_attr(field, format_string) \
-static BUS_ATTR_READER(field##_show,dev,buf) \
-{ \
- struct dahdi_span *span; \
- \
- span = dev_to_span(dev); \
- return sprintf (buf, format_string, span->field); \
+
+#define span_attr(field, format_string) \
+static BUS_ATTR_READER(field##_show, dev, buf) \
+{ \
+ struct dahdi_span *span; \
+ \
+ span = dev_to_span(dev); \
+ return sprintf(buf, format_string, span->field); \
}
span_attr(name, "%s\n");
@@ -258,46 +118,39 @@
span_attr(devicetype, "%s\n");
span_attr(location, "%s\n");
-static BUS_ATTR_READER(is_digital_show,dev,buf)
-{
- struct dahdi_span *span;
+static BUS_ATTR_READER(is_digital_show, dev, buf)
+{
+ struct dahdi_span *span;
int is_digital;
- span = dev_to_span(dev);
+ span = dev_to_span(dev);
is_digital = span->linecompat && (
/* TODO: is this mask too liberal? */
- DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_D4 |
- DAHDI_CONFIG_ESF |
+ DAHDI_CONFIG_AMI | DAHDI_CONFIG_B8ZS | DAHDI_CONFIG_D4 |
+ DAHDI_CONFIG_ESF |
DAHDI_CONFIG_HDB3 | DAHDI_CONFIG_CCS | DAHDI_CONFIG_CRC4
);
- return sprintf (buf, "%d\n", is_digital);
-}
-
-static BUS_ATTR_READER(is_sync_master_show,dev,buf)
-{
- struct dahdi_span *span;
-
- span = dev_to_span(dev);
- return sprintf (buf, "%d\n", dahdi_is_sync_master(span));
+ return sprintf(buf, "%d\n", is_digital);
+}
+
+static BUS_ATTR_READER(is_sync_master_show, dev, buf)
+{
+ struct dahdi_span *span;
+
+ span = dev_to_span(dev);
+ return sprintf(buf, "%d\n", dahdi_is_sync_master(span));
}
static struct device_attribute span_dev_attrs[] = {
- __ATTR_RO(name),
- __ATTR_RO(desc),
+ __ATTR_RO(name),
+ __ATTR_RO(desc),
__ATTR_RO(spantype),
__ATTR_RO(manufacturer),
__ATTR_RO(devicetype),
__ATTR_RO(location),
__ATTR_RO(is_digital),
__ATTR_RO(is_sync_master),
-#if 0
- __ATTR(cls, S_IWUSR, NULL, cls_store),
- __ATTR(xbus_state, S_IRUGO | S_IWUSR, xbus_state_show, xbus_state_store),
-#ifdef SAMPLE_TICKS
- __ATTR(samples, S_IWUSR | S_IRUGO, samples_show, samples_store),
-#endif
-#endif
- __ATTR_NULL,
+ __ATTR_NULL,
};
@@ -311,15 +164,16 @@
}
#ifdef OLD_HOTPLUG_SUPPORT
-static int span_hotplug(struct device *dev, char **envp, int envnum, char *buff, int bufsize)
-{
- struct dahdi_span *span;
-
- if(!dev)
+static int span_hotplug(struct device *dev, char **envp, int envnum,
+ char *buff, int bufsize)
+{
+ struct dahdi_span *span;
+
+ if (!dev)
return -ENODEV;
span = dev_to_span(dev);
envp[0] = buff;
- if(snprintf(buff, bufsize, "SPAN_NAME=%s", span->name) >= bufsize)
+ if (snprintf(buff, bufsize, "SPAN_NAME=%s", span->name) >= bufsize)
return -ENOMEM;
envp[1] = NULL;
return 0;
@@ -331,9 +185,9 @@
XBUS_ADD_UEVENT_VAR("DAHDI_INIT_DIR=%s", initdir); \
XBUS_ADD_UEVENT_VAR("SPAN_NUM=%03d", span->spanno); \
XBUS_ADD_UEVENT_VAR("SPAN_NAME=%s", span->name); \
- } while(0)
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+ } while (0)
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24)
#define XBUS_ADD_UEVENT_VAR(fmt, val...) \
do { \
int err = add_uevent_var(envp, num_envp, &i, \
@@ -343,16 +197,18 @@
return err; \
} while (0)
-static int span_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size)
-{
- struct dahdi_span *span;
+static int span_uevent(struct device *dev, char **envp, int num_envp,
+ char *buffer, int buffer_size)
+{
+ struct dahdi_span *span;
int i = 0;
int len = 0;
- if(!dev)
+ if (!dev)
return -ENODEV;
span = dev_to_span(dev);
- dahdi_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;
@@ -368,12 +224,13 @@
static int span_uevent(struct device *dev, struct kobj_uevent_env *kenv)
{
- struct dahdi_span *span;
-
- if(!dev)
+ struct dahdi_span *span;
+
+ if (!dev)
return -ENODEV;
span = dev_to_span(dev);
- dahdi_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;
}
@@ -448,17 +305,6 @@
static void span_release(struct device *dev)
{
- //struct dahdi_span *span;
-
- //BUG_ON(!dev);
- //span = dev_to_xbus(dev);
- //if(!XBUS_IS(xbus, DISCONNECTED)) {
- // XBUS_ERR(xbus, "Try to release in state %s\n",
- // xbus_statename(XBUS_STATE(xbus)));
- // BUG();
- //}
- //XBUS_INFO(xbus, "[%s] Astribank Release\n", xbus->label);
- //xbus_free(xbus);
}
static struct class *span_class;
@@ -475,7 +321,6 @@
};
static struct device toplevel_device = {
- //.bus_id = "dahdi",
.release = dahdi_release
};
@@ -483,12 +328,13 @@
/*--------- Sysfs Device handling ----*/
/* Register the dev_attrs of the span in sysfs as extra attributes
- to the device
-
+ to the device
+
FIXME: Both this and the following function use internal fields
of struct device_attribute (.attr.name).
*/
-int reg_custom_span_attr(struct dahdi_span *span) {
+static int reg_custom_span_attr(struct dahdi_span *span)
+{
struct device *device = &span->span_device;
struct device_attribute *dev_attrs = span->dev_attrs;
int res = 0;
@@ -496,13 +342,13 @@
if (!dev_attrs)
return 0;
-
+
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--)
+ for (i--; i >= 0; i--)
device_remove_file(device, &dev_attrs[i]);
return res;
}
@@ -511,7 +357,7 @@
return res;
}
-void unreg_custom_span_attr(struct dahdi_span *span)
+static void unreg_custom_span_attr(struct dahdi_span *span)
{
struct device *device = &span->span_device;
struct device_attribute *dev_attrs = span->dev_attrs;
@@ -519,7 +365,7 @@
if (!dev_attrs)
return;
-
+
for (i = 0; dev_attrs[i].attr.name != NULL; i++)
device_remove_file(device, &dev_attrs[i]);
}
@@ -538,7 +384,7 @@
chan_device_unregister(chan);
}
unreg_custom_span_attr(span);
- if(!dev_get_drvdata(span_device))
+ if (!dev_get_drvdata(span_device))
return;
BUG_ON(dev_get_drvdata(span_device) != span);
span_uevent_send(span, KOBJ_OFFLINE);
@@ -563,8 +409,9 @@
dev_set_drvdata(span_device, span);
span_device->release = span_release;
res = device_register(span_device);
- if(res) {
- span_err(span, "%s: device_register failed: %d\n", __func__, res);
+ if (res) {
+ span_err(span, "%s: device_register failed: %d\n", __func__,
+ res);
dev_set_drvdata(span_device, NULL);
return res;
}
@@ -578,7 +425,7 @@
if (res) {
chan_err(chan, "Failed registering in sysfs: %d.\n",
res);
- chan_err(chan, "And nobody wrote error handling yet.\n");
+ chan_err(chan, "And sadly no error handling yet.\n");
return res;
}
}
@@ -605,20 +452,22 @@
goto failed_class_create;
}
span_class->dev_attrs = span_dev_attrs;
- if((res = bus_register(&toplevel_bus_type)) < 0) {
+ res = bus_register(&toplevel_bus_type);
+ if (res < 0) {
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) {
+ res = device_register(&toplevel_device);
+ if (res < 0) {
dahdi_err("%s: device_register(%s) failed. Error number %d",
__func__, dev_name(&toplevel_device), res);
goto failed_busdevice;
}
- if((res = dahdi_driver_chan_init()) < 0) {
+ res = dahdi_driver_chan_init();
+ if (res < 0)
goto failed_chan_bus;
- }
return 0;
failed_chan_bus:
device_unregister(&toplevel_device);
More information about the svn-commits
mailing list