summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wct1xxp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dahdi/wct1xxp.c')
-rw-r--r--drivers/dahdi/wct1xxp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/dahdi/wct1xxp.c b/drivers/dahdi/wct1xxp.c
index 28c86a8..373caa5 100644
--- a/drivers/dahdi/wct1xxp.c
+++ b/drivers/dahdi/wct1xxp.c
@@ -159,6 +159,7 @@ struct t1xxp {
unsigned char ec_chunk2[31][DAHDI_CHUNKSIZE];
unsigned char tempo[32];
struct dahdi_span span; /* Span */
+ struct dahdi_device *ddev;
struct dahdi_chan *chans[31]; /* Channels */
};
@@ -272,10 +273,11 @@ static void t1xxp_release(struct t1xxp *wc)
{
unsigned int x;
- dahdi_unregister(&wc->span);
+ dahdi_unregister_device(wc->ddev);
for (x = 0; x < (wc->ise1 ? 31 : 24); x++) {
kfree(wc->chans[x]);
}
+ dahdi_free_device(wc->ddev);
kfree(wc);
printk(KERN_INFO "Freed a Wildcard\n");
}
@@ -767,13 +769,20 @@ static int t1xxp_software_init(struct t1xxp *wc)
}
if (x >= WC_MAX_CARDS)
return -1;
+
+ wc->ddev = dahdi_create_device();
+
wc->num = x;
sprintf(wc->span.name, "WCT1/%d", wc->num);
snprintf(wc->span.desc, sizeof(wc->span.desc) - 1, "%s Card %d", wc->variety, wc->num);
- wc->span.manufacturer = "Digium";
- strlcpy(wc->span.devicetype, wc->variety, sizeof(wc->span.devicetype));
- snprintf(wc->span.location, sizeof(wc->span.location) - 1,
- "PCI Bus %02d Slot %02d", wc->dev->bus->number, PCI_SLOT(wc->dev->devfn) + 1);
+ wc->ddev->manufacturer = "Digium";
+ wc->ddev->devicetype = wc->variety;
+ wc->ddev->location = kasprintf(GFP_KERNEL, "PCI Bus %02d Slot %02d",
+ wc->dev->bus->number,
+ PCI_SLOT(wc->dev->devfn) + 1);
+ if (!wc->ddev->location)
+ return -ENOMEM;
+
wc->span.irq = wc->dev->irq;
wc->span.chans = wc->chans;
wc->span.flags = DAHDI_FLAG_RBS;
@@ -798,7 +807,8 @@ static int t1xxp_software_init(struct t1xxp *wc)
wc->chans[x]->chanpos = x + 1;
}
wc->span.ops = &t1xxp_span_ops;
- if (dahdi_register(&wc->span, 0)) {
+ list_add_tail(&wc->span.device_node, &wc->ddev->spans);
+ if (dahdi_register_device(wc->ddev, &wc->dev->dev)) {
printk(KERN_NOTICE "Unable to register span with DAHDI\n");
return -1;
}