[PATCH 04/27] staging: comedi: addi_common: remove dma setup/free code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



None of the addi-data drivers that use the "common" code in addi_common.c
support dma. Remove the code that sets up the dma and allocates the buffers
in the attach and the code that frees the buffers in the detach.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 .../staging/comedi/drivers/addi-data/addi_common.c | 54 +---------------------
 1 file changed, 2 insertions(+), 52 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index 75f3dbd..d2d57e5 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -99,7 +99,7 @@ static int addi_attach_pci(struct comedi_device *dev,
 	const struct addi_board *this_board;
 	struct addi_private *devpriv;
 	struct comedi_subdevice *s;
-	int ret, pages, i, n_subdevices;
+	int ret, n_subdevices;
 	unsigned int dw_Dummy;
 
 	this_board = addi_find_boardinfo(dev, pcidev);
@@ -116,8 +116,6 @@ static int addi_attach_pci(struct comedi_device *dev,
 	ret = comedi_pci_enable(pcidev, dev->board_name);
 	if (ret)
 		return ret;
-	if (this_board->i_Dma)
-		pci_set_master(pcidev);
 
 	if (!this_board->pc_EepromChip ||
 	    !strcmp(this_board->pc_EepromChip, ADDIDATA_9054)) {
@@ -178,40 +176,6 @@ static int addi_attach_pci(struct comedi_device *dev,
 		addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0));
 	}
 
-	devpriv->us_UseDma = ADDI_ENABLE;
-
-	if (devpriv->s_EeParameters.i_Dma) {
-		if (devpriv->us_UseDma == ADDI_ENABLE) {
-			/*  alloc DMA buffers */
-			devpriv->b_DmaDoubleBuffer = 0;
-			for (i = 0; i < 2; i++) {
-				for (pages = 4; pages >= 0; pages--) {
-					devpriv->ul_DmaBufferVirtual[i] =
-						(void *) __get_free_pages(GFP_KERNEL, pages);
-
-					if (devpriv->ul_DmaBufferVirtual[i])
-						break;
-				}
-				if (devpriv->ul_DmaBufferVirtual[i]) {
-					devpriv->ui_DmaBufferPages[i] = pages;
-					devpriv->ui_DmaBufferSize[i] =
-						PAGE_SIZE * pages;
-					devpriv->ui_DmaBufferSamples[i] =
-						devpriv->
-						ui_DmaBufferSize[i] >> 1;
-					devpriv->ul_DmaBufferHw[i] =
-						virt_to_bus((void *)devpriv->
-						ul_DmaBufferVirtual[i]);
-				}
-			}
-			if (!devpriv->ul_DmaBufferVirtual[0])
-				devpriv->us_UseDma = ADDI_DISABLE;
-
-			if (devpriv->ul_DmaBufferVirtual[1])
-				devpriv->b_DmaDoubleBuffer = 1;
-		}
-	}
-
 	n_subdevices = 7;
 	ret = comedi_alloc_subdevices(dev, n_subdevices);
 	if (ret)
@@ -363,7 +327,6 @@ static int addi_attach_pci(struct comedi_device *dev,
 
 static void i_ADDI_Detach(struct comedi_device *dev)
 {
-	const struct addi_board *this_board = comedi_board(dev);
 	struct pci_dev *pcidev = comedi_to_pci_dev(dev);
 	struct addi_private *devpriv = dev->private;
 
@@ -372,21 +335,8 @@ static void i_ADDI_Detach(struct comedi_device *dev)
 			i_ADDI_Reset(dev);
 		if (dev->irq)
 			free_irq(dev->irq, dev);
-		if ((this_board->pc_EepromChip == NULL) ||
-		    (strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {
-			if (devpriv->ul_DmaBufferVirtual[0]) {
-				free_pages((unsigned long)devpriv->
-					ul_DmaBufferVirtual[0],
-					devpriv->ui_DmaBufferPages[0]);
-			}
-			if (devpriv->ul_DmaBufferVirtual[1]) {
-				free_pages((unsigned long)devpriv->
-					ul_DmaBufferVirtual[1],
-					devpriv->ui_DmaBufferPages[1]);
-			}
-		} else {
+		if (devpriv->dw_AiBase)
 			iounmap(devpriv->dw_AiBase);
-		}
 	}
 	if (pcidev) {
 		if (dev->iobase)
-- 
1.7.11

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux