summaryrefslogtreecommitdiff
path: root/xhfc/base.c
diff options
context:
space:
mode:
authorxilun <xilun@ruto.localdomain>2012-07-12 19:39:36 +0200
committerxilun <xilun@ruto.localdomain>2012-07-12 19:39:36 +0200
commit1b095edd7bc18a8e0b116771b3b76e2ef2efaa03 (patch)
tree74a3c3eedaefe9c887c67e69534f45501f16b9fa /xhfc/base.c
parentd00a86667ce6381d3fda35e0b2536158921f2ad5 (diff)
source version used for build ad5aec5e1 in binary_lkm
Diffstat (limited to 'xhfc/base.c')
-rw-r--r--xhfc/base.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/xhfc/base.c b/xhfc/base.c
index 0a385ad..0fcbb40 100644
--- a/xhfc/base.c
+++ b/xhfc/base.c
@@ -857,7 +857,7 @@ static void xhfc_span_set_ntte(struct xhfc_span* s, int ntte)
s->span.spantype = ntte ? "NT" : "TE";
}
-static int xhfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
+static int xhfc_spanconfig(struct file *file, struct dahdi_span *span, struct dahdi_lineconfig *lc)
{
struct xhfc_span *xhfc_span;
struct xhfc *xhfc;
@@ -902,7 +902,7 @@ static int xhfc_spanconfig(struct dahdi_span *span, struct dahdi_lineconfig *lc)
return 0;
}
-static int xhfc_chanconfig(struct dahdi_chan *chan, int sigtype)
+static int xhfc_chanconfig(struct file *file, struct dahdi_chan *chan, int sigtype)
{
int alreadyrunning;
struct xhfc_span *xhfc_span = container_of(chan->span, struct xhfc_span,
@@ -954,7 +954,7 @@ static int xhfc_ioctl(struct dahdi_chan *chan, unsigned int cmd,
return -ENOTTY;
}
-static int xhfc_span_startup(struct dahdi_span* s)
+static int xhfc_span_startup(struct file *file, struct dahdi_span* s)
{
struct xhfc_span *xhfc_span = container_of(s, struct xhfc_span, span);
activate_request(xhfc_span);
@@ -1006,7 +1006,6 @@ static void init_spans(struct xhfc* x)
dahdi_span->ops = &xhfc_span_ops;
dahdi_span->chans = xhfc_span->chans;
- dahdi_span->irq = x->pi->pci_dev->irq;
dahdi_span->offset = i;
dahdi_span->channels = CHANS_PER_SPAN;
dahdi_span->flags = 0;
@@ -1017,19 +1016,9 @@ static void init_spans(struct xhfc* x)
sprintf(dahdi_span->name, "XIVO_XHFC/%d", i+1);
sprintf(dahdi_span->desc, "XHFC port %d", i+1);
- dahdi_span->manufacturer = "Avencall";
- dahdi_copy_string(dahdi_span->devicetype, "XHFC-4SU",
- sizeof(dahdi_span->devicetype));
- sprintf(dahdi_span->location, "PCI Bus %02d Slot %02d",
- x->pi->pci_dev->bus->number,
- PCI_SLOT(x->pi->pci_dev->devfn) + 1);
-
+ // BUGBUG: free all that:
dahdi_span->alarms = DAHDI_ALARM_RED;
-
- init_waitqueue_head(&dahdi_span->maintq);
- /* kinda everyone does this */
-
/* now initialize each channel in the span */
for (j=0; j < CHANS_PER_SPAN; j++) {
xhfc_span->chans[j] = &xhfc_span->_chans[j];
@@ -1183,6 +1172,14 @@ static int __devinit xhfc_init_one(struct pci_dev *pdev,
goto err_request_irq;
}
+ pi->xhfc.ddev = dahdi_create_device();
+ pi->xhfc.ddev->manufacturer = "Avencall";
+ pi->xhfc.ddev->devicetype = kasprintf(GFP_KERNEL, "xhfc-4su");
+ pi->xhfc.ddev->location = kasprintf(GFP_KERNEL,
+ "PCI Bus %02d Slot %02d",
+ pi->pci_dev->bus->number,
+ PCI_SLOT(pi->pci_dev->devfn) + 1);
+
init_spans(&pi->xhfc);
xhfc_init_and_configure(&pi->xhfc);
@@ -1199,12 +1196,14 @@ static int __devinit xhfc_init_one(struct pci_dev *pdev,
#endif
for (span = 0; span < SPANS_PER_CHIP; span++)
- if ((rc = dahdi_register(&pi->xhfc.spans[span].span,
- /*prefmaster*/ 0)) < 0) {
- printk(KERN_WARNING "%s %s: couldn't register spans\n",
- DRIVER_NAME, __func__);
- goto err_in_dahdi_register;
- }
+ list_add_tail(&pi->xhfc.spans[span].span.device_node,
+ &pi->xhfc.ddev->spans);
+
+ if ((rc = dahdi_register_device(pi->xhfc.ddev, &pdev->dev))) {
+ printk(KERN_WARNING "%s %s: couldn't register spans\n",
+ DRIVER_NAME, __func__);
+ goto err_in_dahdi_register;
+ }
enable_interrupts(&pi->xhfc);
@@ -1228,8 +1227,7 @@ static int __devinit xhfc_init_one(struct pci_dev *pdev,
return 0;
err_in_dahdi_register:
- for (span--; span >= 0; span--)
- dahdi_unregister(&pi->xhfc.spans[span].span);
+ dahdi_unregister_device(pi->xhfc.ddev);
#ifdef AUDIO
err_tdm_config_port:
#endif
@@ -1255,7 +1253,6 @@ err_enable_device:
static void __devexit xhfc_remove_one(struct pci_dev *pdev)
{
- int i;
struct xhfc_pi *pi;
pi = pci_get_drvdata(pdev);
@@ -1264,8 +1261,7 @@ static void __devexit xhfc_remove_one(struct pci_dev *pdev)
printk(KERN_INFO "%s %s: removing card\n",
DRIVER_NAME, __func__);
- for (i = 0; i < SPANS_PER_CHIP; i++)
- dahdi_unregister(&pi->xhfc.spans[i].span);
+ dahdi_unregister_device(pi->xhfc.ddev);
release_card_irq(pi);