summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2012-05-31 13:08:35 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-06-05 03:49:20 (GMT)
commit181ad5edbf6d3c244263b770e9dd4eda645de5bf (patch)
tree59f145143db0a8fb7e2e5c8366c48a3cd096ce2c /drivers
parent485455d01b26e849d30c2b20ce20a4d6fc50555e (diff)
downloadlinux-fsl-qoriq-181ad5edbf6d3c244263b770e9dd4eda645de5bf.tar.xz
staging: comedi: amplc_dio200: Change return type of dio200_find_pci()
dio200_find_pci() finds a supported PCI device, returning 0 on success or -EIO on failure and returning the pointer to the PCI device via a struct pci_dev ** parameter. Change it to return the struct pci_dev * on success or NULL on failure. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index be932e8..6d04378 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -463,14 +463,11 @@ struct dio200_subdev_intr {
* This function looks for a PCI device matching the requested board name,
* bus and slot.
*/
-static int
-dio200_find_pci(struct comedi_device *dev, int bus, int slot,
- struct pci_dev **pci_dev_p)
+static struct pci_dev *
+dio200_find_pci(struct comedi_device *dev, int bus, int slot)
{
struct pci_dev *pci_dev = NULL;
- *pci_dev_p = NULL;
-
/* Look for matching PCI device. */
for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL);
pci_dev != NULL;
@@ -504,8 +501,7 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot,
}
/* Found a match. */
- *pci_dev_p = pci_dev;
- return 0;
+ return pci_dev;
}
/* No match found. */
if (bus || slot) {
@@ -516,7 +512,7 @@ dio200_find_pci(struct comedi_device *dev, int bus, int slot,
dev_err(dev->class_dev, "error! no %s found!\n",
thisboard->name);
}
- return -EIO;
+ return NULL;
}
/*
@@ -1293,15 +1289,15 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return ret;
} else if (IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI) &&
thisboard->bustype == pci_bustype) {
- struct pci_dev *pci_dev = NULL;
+ struct pci_dev *pci_dev;
int bus, slot;
bus = it->options[0];
slot = it->options[1];
share_irq = 1;
- ret = dio200_find_pci(dev, bus, slot, &pci_dev);
- if (ret < 0)
- return ret;
+ pci_dev = dio200_find_pci(dev, bus, slot);
+ if (pci_dev == NULL)
+ return -EIO;
devpriv->pci_dev = pci_dev;
ret = comedi_pci_enable(pci_dev, DIO200_DRIVER_NAME);
if (ret < 0) {