[PATCH 02/34] staging: comedi: addi_common.c: remove i_ADDI_Reset()

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

 



The addi_apci_035 and addi_apci_1500 are the only drivers left that use
this function in addi_common.c. The function simply calls the 'reset'
function that is in the boardinfo of the driver. Both drivers use the
same 'reset' function for all boardnfo entries.

Remove the i_ADDI_Reset() function as well as the 'reset' boardinfo and
just call the 'reset' function directly.

The i_ADDI_Reset() is called by addi_auto_attach() in addi_common.c after
a sucessful attach. Modify the (*auto_attach) in the drivers to call the
'reset' function directly and remove it from addi_auto_attach().

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_apci_035.c         | 13 ++++++++++---
 drivers/staging/comedi/drivers/addi_apci_1500.c        | 13 ++++++++++---
 3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index 51574a8..d0bd812 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -65,14 +65,6 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d)
 	return IRQ_RETVAL(1);
 }
 
-static int i_ADDI_Reset(struct comedi_device *dev)
-{
-	const struct addi_board *this_board = dev->board_ptr;
-
-	this_board->reset(dev);
-	return 0;
-}
-
 static int addi_auto_attach(struct comedi_device *dev,
 				      unsigned long context_unused)
 {
@@ -262,6 +254,5 @@ static int addi_auto_attach(struct comedi_device *dev,
 		s->type = COMEDI_SUBD_UNUSED;
 	}
 
-	i_ADDI_Reset(dev);
 	return 0;
 }
diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c
index b06fde1..dd28adb 100644
--- a/drivers/staging/comedi/drivers/addi_apci_035.c
+++ b/drivers/staging/comedi/drivers/addi_apci_035.c
@@ -28,7 +28,6 @@ static const struct addi_board apci035_boardtypes[] = {
 		.ui_MinAcquisitiontimeNs = 10000,
 		.ui_MinDelaytimeNs	= 100000,
 		.interrupt		= apci035_interrupt,
-		.reset			= apci035_reset,
 		.ai_config		= apci035_ai_config,
 		.ai_read		= apci035_ai_read,
 		.timer_config		= apci035_timer_config,
@@ -40,15 +39,23 @@ static const struct addi_board apci035_boardtypes[] = {
 static int apci035_auto_attach(struct comedi_device *dev,
 			       unsigned long context)
 {
+	int ret;
+
 	dev->board_ptr = &apci035_boardtypes[0];
 
-	return addi_auto_attach(dev, context);
+	ret = addi_auto_attach(dev, context);
+	if (ret)
+		return ret;
+
+	apci035_reset(dev);
+
+	return 0;
 }
 
 static void apci035_detach(struct comedi_device *dev)
 {
 	if (dev->iobase)
-		i_ADDI_Reset(dev);
+		apci035_reset(dev);
 	comedi_pci_detach(dev);
 }
 
diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c
index 50a147f..d4b4261 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1500.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1500.c
@@ -21,7 +21,6 @@ static const struct addi_board apci1500_boardtypes[] = {
 		.i_DoMaxdata		= 0xffff,
 		.i_Timer		= 1,
 		.interrupt		= apci1500_interrupt,
-		.reset			= apci1500_reset,
 		.di_config		= apci1500_di_config,
 		.di_read		= apci1500_di_read,
 		.di_write		= apci1500_di_write,
@@ -39,15 +38,23 @@ static const struct addi_board apci1500_boardtypes[] = {
 static int apci1500_auto_attach(struct comedi_device *dev,
 				unsigned long context)
 {
+	int ret;
+
 	dev->board_ptr = &apci1500_boardtypes[0];
 
-	return addi_auto_attach(dev, context);
+	ret = addi_auto_attach(dev, context);
+	if (ret)
+		return ret;
+
+	apci1500_reset(dev);
+
+	return 0;
 }
 
 static void apci1500_detach(struct comedi_device *dev)
 {
 	if (dev->iobase)
-		i_ADDI_Reset(dev);
+		apci1500_reset(dev);
 	comedi_pci_detach(dev);
 }
 
-- 
2.0.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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