[PATCH 13/18] staging: comedi: addi-data: remove 'allocated' from the private data

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

 



This variable is only used as a flag to indicate that the pci device
has been enabled. Use the comedi_device 'iobase' variable to indicate
this instead. This is how it's normally handled in the comedi pci
drivers.

Make the call to comedi_pci_disabled() in i_ADDI_Detach() common
and move it to the end of the function. Both the if and else case
require it.

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

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index a9295f2..02d1015 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -118,7 +118,6 @@ static int addi_attach_pci(struct comedi_device *dev,
 		return ret;
 	if (this_board->i_Dma)
 		pci_set_master(pcidev);
-	devpriv->allocated = 1;
 
 	if (!this_board->pc_EepromChip ||
 	    !strcmp(this_board->pc_EepromChip, ADDIDATA_9054)) {
@@ -385,8 +384,6 @@ static void i_ADDI_Detach(struct comedi_device *dev)
 			free_irq(dev->irq, dev);
 		if ((this_board->pc_EepromChip == NULL) ||
 		    (strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {
-			if (devpriv->allocated)
-				comedi_pci_disable(pcidev);
 			if (devpriv->ul_DmaBufferVirtual[0]) {
 				free_pages((unsigned long)devpriv->
 					ul_DmaBufferVirtual[0],
@@ -399,8 +396,10 @@ static void i_ADDI_Detach(struct comedi_device *dev)
 			}
 		} else {
 			iounmap(devpriv->dw_AiBase);
-			if (devpriv->allocated)
-				comedi_pci_disable(pcidev);
 		}
 	}
+	if (pcidev) {
+		if (dev->iobase)
+			comedi_pci_disable(pcidev);
+	}
 }
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h
index c72e79d..2773359 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.h
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h
@@ -312,7 +312,6 @@ struct addi_private {
 	int i_IobaseAddon;	/* addon base address */
 	int i_IobaseReserved;
 	void __iomem *dw_AiBase;
-	unsigned char allocated;		/*  we have blocked card */
 	unsigned char b_ValidDriver;	/*  driver is ok */
 	unsigned char b_AiContinuous;	/*  we do unlimited AI */
 	unsigned char b_AiInitialisation;
-- 
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