[PATCH 14/40] staging: comedi: me4000: absorb get_registers() into its caller

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

 



The get_registers() function reads the pci base addresses used
in the driver. It's simple enough, just move the code into the
function that calls it.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/me4000.c | 46 ++++++++++++---------------------
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 71ca75f..f7ef0cb 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -215,7 +215,6 @@ static const struct me4000_board me4000_boards[] = {
 /*-----------------------------------------------------------------------------
   Meilhaus function prototypes
   ---------------------------------------------------------------------------*/
-static int get_registers(struct comedi_device *dev, struct pci_dev *pci_dev_p);
 static int init_board_info(struct comedi_device *dev,
 			   struct pci_dev *pci_dev_p);
 static int init_ao_context(struct comedi_device *dev);
@@ -316,14 +315,22 @@ found:
 		return result;
 	}
 
-	/* Get the PCI base registers */
-	result = get_registers(dev, pci_device);
-	if (result) {
-		printk(KERN_ERR
-		       "comedi%d: me4000: me4000_probe(): "
-		       "Cannot get registers\n", dev->minor);
-		return result;
-	}
+	info->plx_regbase = pci_resource_start(pci_device, 1);
+	if (!info->plx_regbase)
+		return -ENODEV;
+
+	info->me4000_regbase = pci_resource_start(pci_device, 2);
+	if (!info->me4000_regbase)
+		return -ENODEV;
+
+	info->timer_regbase = pci_resource_start(pci_device, 3);
+	if (!info->timer_regbase)
+		return -ENODEV;
+
+	info->program_regbase = pci_resource_start(pci_device, 5);
+	if (!info->program_regbase)
+		return -ENODEV;
+
 	/* Initialize board info */
 	result = init_board_info(dev, pci_device);
 	if (result) {
@@ -381,27 +388,6 @@ found:
 	return 0;
 }
 
-static int get_registers(struct comedi_device *dev, struct pci_dev *pci_dev_p)
-{
-	info->plx_regbase = pci_resource_start(pci_dev_p, 1);
-	if (!info->plx_regbase)
-		return -ENODEV;
-
-	info->me4000_regbase = pci_resource_start(pci_dev_p, 2);
-	if (!info->me4000_regbase)
-		return -ENODEV;
-
-	info->timer_regbase = pci_resource_start(pci_dev_p, 3);
-	if (!info->timer_regbase)
-		return -ENODEV;
-
-	info->program_regbase = pci_resource_start(pci_dev_p, 5);
-	if (!info->program_regbase)
-		return -ENODEV;
-
-	return 0;
-}
-
 static int init_board_info(struct comedi_device *dev, struct pci_dev *pci_dev_p)
 {
 	int result;
-- 
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