summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2012-03-21 19:12:10 +0000
committerShaun Ruffell <sruffell@digium.com>2012-03-21 19:12:10 +0000
commit9ea13e27ba8210da9661a7514e93aa8bbd0be265 (patch)
treef057c59b45018324ddcfc3d83e2b7501f62a345d /drivers
parentd75f326e15374b0bb6a9a71f2d3c50cff24d3b37 (diff)
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@digium.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10563 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.6@10571 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dahdi/dahdi_dynamic.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/dahdi/dahdi_dynamic.c b/drivers/dahdi/dahdi_dynamic.c
index cbcdce7..aec4a7d 100644
--- a/drivers/dahdi/dahdi_dynamic.c
+++ b/drivers/dahdi/dahdi_dynamic.c
@@ -605,9 +605,10 @@ static int _create_dynamic(struct dahdi_dynamic_span *dds)
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;
@@ -658,6 +659,9 @@ static int _create_dynamic(struct dahdi_dynamic_span *dds)
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)) {