[dahdi-commits] sruffell: linux/trunk r10563 - in /linux/trunk: drivers/dahdi/ include/dahdi/

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Mar 21 13:56:24 CDT 2012


Author: sruffell
Date: Wed Mar 21 13:56:21 2012
New Revision: 10563

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10563
Log:
dahdi_dynamic: Since dynamic devices are 'parentless' we must name them.

This in conjunction with r10449 "A parent-less device should not crash dahdi",
this allows dahdi_dynamic spans to work post the dahdi_devices changes in
2.6.0.

The full address of the device is not used since kernels prior to 2.6.31 limit
the length of a devicename to 20 characters.  The full address of the device
can be pulled out of the "hardware_id" and "type" fields of the span.

This patch is just to get things working again. dahdi_dynamic devices *may*
still have issues if the auto_assign_spans module parameter is 0.

Internal-Issue-ID: DAHLIN-280
Reported-by: Pavel Selivanov
Signed-off-by: Shaun Ruffell <sruffell at digium.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi_dynamic.c
    linux/trunk/include/dahdi/kernel.h

Modified: linux/trunk/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=10563&r1=10562&r2=10563
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic.c Wed Mar 21 13:56:21 2012
@@ -600,9 +600,10 @@
 	strlcpy(d->dname, dds->driver, sizeof(d->dname));
 	strlcpy(d->addr, dds->addr, sizeof(d->addr));
 	d->timing = dds->timing;
-	sprintf(d->span.name, "DYN/%s/%s", dds->driver, dds->addr);
-	sprintf(d->span.desc, "Dynamic '%s' span at '%s'",
-		dds->driver, dds->addr);
+	snprintf(d->span.name, sizeof(d->span.name), "DYN/%s/%s",
+		 dds->driver, dds->addr);
+	snprintf(d->span.desc, sizeof(d->span.desc),
+		 "Dynamic '%s' span at '%s'", dds->driver, dds->addr);
 	d->span.deflaw = DAHDI_LAW_MULAW;
 	d->span.flags |= DAHDI_FLAG_RBS;
 	d->span.chans = d->chans;
@@ -653,6 +654,9 @@
 		return res;
 	}
 
+	d->ddev->devicetype = d->span.name;
+	d->ddev->hardware_id = d->span.name;
+	dev_set_name(&d->ddev->dev, "dynamic:%s:%d", dds->driver, dtd->id++);
 	list_add_tail(&d->span.device_node, &d->ddev->spans);
 	/* Whee!  We're created.  Now register the span */
 	if (dahdi_register_device(d->ddev, d->dev)) {

Modified: linux/trunk/include/dahdi/kernel.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/include/dahdi/kernel.h?view=diff&rev=10563&r1=10562&r2=10563
==============================================================================
--- linux/trunk/include/dahdi/kernel.h (original)
+++ linux/trunk/include/dahdi/kernel.h Wed Mar 21 13:56:21 2012
@@ -1096,6 +1096,9 @@
 
 	struct list_head list;
 	struct module *owner;
+
+	/*! Numberic id of next device created by this driver. */
+	unsigned int id;
 };
 
 /*! \brief Receive a dynamic span message */




More information about the dahdi-commits mailing list