[PATCH 10/18] staging: comedi: addi-data: remove i_pci_card_free()

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

 



This function calls comedi_pci_disable() to disable the pci
device when detached. It's only called from i_ADDI_Detach().
Move the code there and delete the function.

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_amcc_s5933.h   | 16 ----------------
 drivers/staging/comedi/drivers/addi-data/addi_common.c   | 12 ++++++++----
 2 files changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
index 08b3240..2011f4b 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
+++ b/drivers/staging/comedi/drivers/addi-data/addi_amcc_s5933.h
@@ -225,8 +225,6 @@ struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 						    unsigned short pci_bus,
 						    unsigned short pci_slot);
 
-int i_pci_card_free(struct pcilst_struct *amcc);
-
 /****************************************************************************/
 
 /* build list of amcc cards in this system */
@@ -327,20 +325,6 @@ int i_find_free_pci_card_by_position(unsigned short vendor_id,
 }
 
 /****************************************************************************/
-/* mark card as free */
-int i_pci_card_free(struct pcilst_struct *amcc)
-{
-	if (!amcc)
-		return -1;
-
-	if (!amcc->used)
-		return 1;
-	amcc->used = 0;
-	comedi_pci_disable(amcc->pcidev);
-	return 0;
-}
-
-/****************************************************************************/
 /* select and alloc card */
 struct pcilst_struct *ptr_select_and_alloc_pci_card(unsigned short vendor_id,
 						    unsigned short device_id,
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index 2dab403..f6c36ac 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -402,8 +402,10 @@ 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)
-				i_pci_card_free(devpriv->amcc);
+			if (devpriv->allocated) {
+				comedi_pci_disable(devpriv->amcc->pcidev);
+				devpriv->amcc->used = 0;
+			}
 			if (devpriv->ul_DmaBufferVirtual[0]) {
 				free_pages((unsigned long)devpriv->
 					ul_DmaBufferVirtual[0],
@@ -416,8 +418,10 @@ static void i_ADDI_Detach(struct comedi_device *dev)
 			}
 		} else {
 			iounmap(devpriv->dw_AiBase);
-			if (devpriv->allocated)
-				i_pci_card_free(devpriv->amcc);
+			if (devpriv->allocated) {
+				comedi_pci_disable(devpriv->amcc->pcidev);
+				devpriv->amcc->used = 0;
+			}
 		}
 		if (pci_list_builded) {
 			v_pci_card_list_cleanup(this_board->i_VendorId);
-- 
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