Commit: 0fcdafb83b9b4e5c48410b3ca91b1f237ad60dbc
staging: comedi: addi-data: cleanup reading of the PCI bars

Changed this test before reading the PCI bars:

        if ((this_board->pc_EepromChip == NULL)
                || (strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {

to this:

        if (!this_board->pc_EepromChip ||
            !strcmp(this_board->pc_EepromChip, ADDIDATA_9054)) {

I just noticed that the strcmp test is wrong.

This fixes the test and adds a comment for it.

This error "broke" the addi-data drivers but they are broken anyway
since they don't follow the comedi core API.

The addi_apci_1032 driver has been converted to follow the comedi core
API. This error effects that driver since the iobase for it should be
found in PCI bar 1 not 2. This fixes that also.

Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: Ian Abbott <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/comedi/drivers/addi-data/addi_common.c | 4 +++-
 drivers/staging/comedi/drivers/addi_apci_1032.c        | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c 
b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index 2500d53..8c0fbf4 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -119,7 +119,8 @@ static int __devinit addi_auto_attach(struct comedi_device 
*dev,
                return ret;
 
        if (!this_board->pc_EepromChip ||
-           !strcmp(this_board->pc_EepromChip, ADDIDATA_9054)) {
+           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
@@ -129,6 +130,7 @@ static int __devinit addi_auto_attach(struct comedi_device 
*dev,
                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),
diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c 
b/drivers/staging/comedi/drivers/addi_apci_1032.c
index 14b5989..060516b 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1032.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1032.c
@@ -265,7 +265,7 @@ static int __devinit apci1032_auto_attach(struct 
comedi_device *dev,
        if (ret)
                return ret;
 
-       dev->iobase = pci_resource_start(pcidev, 2);
+       dev->iobase = pci_resource_start(pcidev, 1);
 
        if (pcidev->irq > 0) {
                ret = request_irq(pcidev->irq, apci1032_interrupt, IRQF_SHARED,
-- 
1.7.11

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to