[zaptel-commits] kpfleming: branch mogorman/zaptel-1.2-transcoder r2016 - /team/mogorman/zapte...

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Mon Jan 29 15:59:15 MST 2007


Author: kpfleming
Date: Mon Jan 29 16:59:14 2007
New Revision: 2016

URL: http://svn.digium.com/view/zaptel?view=rev&rev=2016
Log:
use kmalloc instead of vmalloc

Modified:
    team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c

Modified: team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c?view=diff&rev=2016&r1=2015&r2=2016
==============================================================================
--- team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c (original)
+++ team/mogorman/zaptel-1.2-transcoder/wctc4xxp/base.c Mon Jan 29 16:59:14 2007
@@ -33,7 +33,6 @@
 #include <linux/sched.h>
 #include <linux/pci.h>
 #include <linux/interrupt.h>
-#include <linux/vmalloc.h>
 #include <linux/mman.h>
 #include <linux/delay.h>
 #include <asm/io.h>
@@ -1336,7 +1335,7 @@
 	if (pci_enable_device(pdev))
 		return -EIO;
 
-	if (!(wc = vmalloc(sizeof(*wc))))
+	if (!(wc = kmalloc(sizeof(*wc), GFP_KERNEL)))
 		return -ENOMEM;
 
 	ifaces[x] = wc;
@@ -1424,17 +1423,17 @@
 	
 	wc->uencode = zt_transcoder_alloc(wc->numchannels);
 	wc->udecode = zt_transcoder_alloc(wc->numchannels);
-	encoders = vmalloc(sizeof(*encoders) * wc->numchannels);
-	decoders = vmalloc(sizeof(*decoders) * wc->numchannels);
+	encoders = kmalloc(sizeof(*encoders) * wc->numchannels, GFP_KERNEL);
+	decoders = kmalloc(sizeof(*decoders) * wc->numchannels, GFP_KERNEL);
 	if (!wc->uencode || !wc->udecode || !encoders || !decoders) {
 		if (wc->uencode)
 			zt_transcoder_free(wc->uencode);
 		if (wc->udecode)
 			zt_transcoder_free(wc->udecode);
 		if (encoders)
-			vfree(encoders);
+			kfree(encoders);
 		if (decoders)
-			vfree(decoders);
+			kfree(decoders);
 
 		return -ENOMEM;
 	}
@@ -1473,7 +1472,7 @@
 			release_region(wc->iobase, 0xFF);
 		pci_free_consistent(pdev, PCI_WINDOW_SIZE, (void *) wc->writechunk, wc->writedma);
 		pci_set_drvdata(pdev, NULL);
-		vfree(wc);
+		kfree(wc);
 		/* TODO: what about all the encoders and decoders (do this earlier)? */
 		return -EIO;
 	}
@@ -1487,7 +1486,7 @@
 			release_region(wc->iobase, 0xff);
 		pci_free_consistent(pdev, PCI_WINDOW_SIZE, (void *) wc->writechunk, wc->writedma);
 		pci_set_drvdata(pdev, NULL);
-		vfree(wc);
+		kfree(wc);
 		return -EIO;
 	}
 	
@@ -1506,7 +1505,7 @@
 			release_region(wc->iobase, 0xff);
 		pci_free_consistent(pdev, PCI_WINDOW_SIZE, (void *) wc->writechunk, wc->writedma);
 		pci_set_drvdata(pdev, NULL);
-		vfree(wc);
+		kfree(wc);
 		return -EIO;
 	}
 		
@@ -1519,7 +1518,7 @@
 			release_region(wc->iobase, 0xff);
 		pci_free_consistent(pdev, PCI_WINDOW_SIZE, (void *) wc->writechunk, wc->writedma);
 		pci_set_drvdata(pdev, NULL);
-		vfree(wc);
+		kfree(wc);
 		return -EIO;
 	}
 		
@@ -1539,7 +1538,7 @@
 {
 	if (wc->freeregion)
 		release_region(wc->iobase, 0xff);
-	vfree(wc);
+	kfree(wc);
 }
 
 static void __devexit remove_one(struct pci_dev *pdev)
@@ -1551,6 +1550,9 @@
 
 	if (!wc)
 		return;
+
+	zt_transcoder_unregister(wc->udecode);
+	zt_transcoder_unregister(wc->uencode);
 
 	if (debug) {
 		debug_printk(1, "wc->ztsnd_rtx = %d\n", wc->ztsnd_rtx);
@@ -1568,13 +1570,6 @@
 		}
 	}
 	
-	zt_transcoder_unregister(wc->udecode);
-	zt_transcoder_unregister(wc->uencode);
-	zt_transcoder_free(wc->uencode);
-	zt_transcoder_free(wc->udecode);
-	vfree(wc->uencode->channels[0].pvt);
-	vfree(wc->udecode->channels[0].pvt);
-	
 	/* Stop any DMA */
 	stop_dma(wc);
 	
@@ -1588,6 +1583,12 @@
 	pci_free_consistent(pdev, PCI_WINDOW_SIZE, (void *) wc->writechunk, wc->writedma);
 	free_irq(pdev->irq, wc);
 	
+	kfree(wc->uencode->channels[0].pvt);
+	kfree(wc->udecode->channels[0].pvt);
+
+	zt_transcoder_free(wc->uencode);
+	zt_transcoder_free(wc->udecode);
+
 	/* Release span, possibly delayed */
 	release(wc);
 }



More information about the zaptel-commits mailing list