[svn-commits] kpfleming: linux/trunk r4521 - in /linux/trunk/drivers/dahdi: ./ wctdm24xxp/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jul 2 12:21:45 CDT 2008


Author: kpfleming
Date: Wed Jul  2 12:21:44 2008
New Revision: 4521

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4521
Log:
fix up the last few drivers for the new single-allocation channel changes

(related to issue 0012657)

Modified:
    linux/trunk/drivers/dahdi/pciradio.c
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/trunk/drivers/dahdi/pciradio.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/pciradio.c?view=diff&rev=4521&r1=4520&r2=4521
==============================================================================
--- linux/trunk/drivers/dahdi/pciradio.c (original)
+++ linux/trunk/drivers/dahdi/pciradio.c Wed Jul  2 12:21:44 2008
@@ -200,7 +200,8 @@
 #define	RADMODE_IGNORECT 16
 #define	RADMODE_NOENCODE 32
 	unsigned char corthresh[NUM_CHANS];
-	struct dahdi_chan chans[NUM_CHANS];
+	struct dahdi_chan _chans[NUM_CHANS];
+	struct dahdi_chan *chans;
 	unsigned char mx828_addr;
 	struct encdec encdec;
 	unsigned long lastremcmd;
@@ -1479,7 +1480,7 @@
 		rad->ctcssacquiretime[x] = RAD_CTCSS_ACQUIRE_TIME;
 		rad->ctcsstalkofftime[x] = RAD_CTCSS_TALKOFF_TIME;
 	}
-	rad->span.chans = rad->chans;
+	rad->span.chans = &rad->chans;
 	rad->span.channels = rad->nchans;
 	rad->span.hooksig = pciradio_hooksig;
 	rad->span.open = pciradio_open;
@@ -1718,6 +1719,7 @@
 			int i;
 
 			ifaces[x] = rad;
+			rad->chans = rad->_chans;
 			memset(rad, 0, sizeof(struct pciradio));
 			spin_lock_init(&rad->lock);
 			rad->nchans = 4;

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=4521&r1=4520&r2=4521
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Wed Jul  2 12:21:44 2008
@@ -3745,6 +3745,18 @@
 
 static struct pci_driver wctdm_driver;
 
+static void free_wc(struct wctdm *wc)
+{
+	unsigned int x;
+
+	for (x = 0; x < wc->cards; x++) {
+		if (wc->chans[x]) {
+			kfree(wc->chans[x]);
+		}
+	}
+	kfree(wc);
+}
+
 static int __devinit wctdm_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	struct wctdm *wc;
@@ -3754,11 +3766,10 @@
 	int ret;
 
 retry:
-	wc = kmalloc(sizeof(struct wctdm), GFP_KERNEL);
-	if (!wc) {
-		/* \todo Print debug message. */
+	if (!(wc = kmalloc(sizeof(*wc), GFP_KERNEL))) {
 		return -ENOMEM;
 	}
+
 	memset(wc, 0, sizeof(*wc));
 	spin_lock(&ifacelock);	
 	/* \todo this is a candidate for removal... */
@@ -3771,7 +3782,7 @@
 	spin_unlock(&ifacelock);
 
 	snprintf(wc->board_name, sizeof(wc->board_name)-1, "%s%d",
-		wctdm_driver.name, i);
+		 wctdm_driver.name, i);
 	ret = voicebus_init(pdev, SFRAME_SIZE, wc->board_name,
 		handle_receive, handle_transmit, wc, &wc->vb);
 	if (ret) {
@@ -3832,6 +3843,14 @@
 	/* Final initialization */
 	wctdm_post_initialize(wc);
 	
+	for (i = 0; i < wc->cards; i++) {
+		if (!(wc->chans[i] = kmalloc(sizeof(*wc->chans[i]), GFP_KERNEL))) {
+			free_wc(wc);
+			return -ENOMEM;
+		}
+		memset(wc->chans[i], 0, sizeof(*wc->chans[i]));
+	}
+
 	/* We should be ready for DAHDI to come in now. */
 	if (dahdi_register(&wc->span, 0)) {
 		printk("Unable to register span with DAHDI\n");
@@ -3864,7 +3883,7 @@
 	ifaces[i] = NULL;
 	spin_unlock(&ifacelock);
 	
-	kfree(wc);
+	free_wc(wc);
 }
 
 static void __devexit wctdm_remove_one(struct pci_dev *pdev)




More information about the svn-commits mailing list