]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: comedi: addi_apci_2032: simplify the PCI bar reading
authorH Hartley Sweeten <hartleys@visionengravers.com>
Fri, 30 Nov 2012 01:16:45 +0000 (18:16 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Nov 2012 02:05:29 +0000 (18:05 -0800)
The board supported by this driver has a 93c76 eeprom. Knowing this
information allows simplifying the code that reads the PCI bars to
get the iobase address.

Also, since the 'dw_AiBase' is not ioremap'ed we can remove the iounmap
in the detach.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_apci_2032.c

index 5e2cf0dec8cb7739b5434832573027d70ec7ff9a..e0b307cc41a4db8c321ee24c91ceea19bc228fb3 100644 (file)
@@ -91,24 +91,10 @@ static int apci2032_auto_attach(struct comedi_device *dev,
        if (ret)
                return ret;
 
-       if (!this_board->pc_EepromChip ||
-           strcmp(this_board->pc_EepromChip, ADDIDATA_9054)) {
-               /* board does not have an eeprom or is not ADDIDATA_9054 */
-               if (this_board->i_IorangeBase1)
-                       dev->iobase = pci_resource_start(pcidev, 1);
-               else
-                       dev->iobase = pci_resource_start(pcidev, 0);
-
-               devpriv->iobase = dev->iobase;
-               devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
-               devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
-       } else {
-               /* board has an ADDIDATA_9054 eeprom */
-               dev->iobase = pci_resource_start(pcidev, 2);
-               devpriv->iobase = pci_resource_start(pcidev, 2);
-               devpriv->dw_AiBase = ioremap(pci_resource_start(pcidev, 3),
-                                            this_board->i_IorangeBase3);
-       }
+       dev->iobase = pci_resource_start(pcidev, 1);
+       devpriv->iobase = dev->iobase;
+       devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0);
+       devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2);
        devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3);
 
        /* Initialize parameters that can be overridden in EEPROM */
@@ -214,8 +200,6 @@ static void apci2032_detach(struct comedi_device *dev)
                        apci2032_reset(dev);
                if (dev->irq)
                        free_irq(dev->irq, dev);
-               if (devpriv->dw_AiBase)
-                       iounmap(devpriv->dw_AiBase);
        }
        if (pcidev) {
                if (dev->iobase)