Commit 01ea83bc authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_pci224: Change return type of pci224_find_pci()

pci224_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: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eedc1b7b
...@@ -1255,14 +1255,11 @@ static const struct pci224_board ...@@ -1255,14 +1255,11 @@ static const struct pci224_board
* This function looks for a PCI device matching the requested board name, * This function looks for a PCI device matching the requested board name,
* bus and slot. * bus and slot.
*/ */
static int static struct pci_dev *
pci224_find_pci(struct comedi_device *dev, int bus, int slot, pci224_find_pci(struct comedi_device *dev, int bus, int slot)
struct pci_dev **pci_dev_p)
{ {
struct pci_dev *pci_dev = NULL; struct pci_dev *pci_dev = NULL;
*pci_dev_p = NULL;
/* Look for matching PCI device. */ /* Look for matching PCI device. */
for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL); for (pci_dev = pci_get_device(PCI_VENDOR_ID_AMPLICON, PCI_ANY_ID, NULL);
pci_dev != NULL; pci_dev != NULL;
...@@ -1289,8 +1286,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, ...@@ -1289,8 +1286,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot,
} }
/* Found a match. */ /* Found a match. */
*pci_dev_p = pci_dev; return pci_dev;
return 0;
} }
/* No match found. */ /* No match found. */
if (bus || slot) { if (bus || slot) {
...@@ -1301,7 +1297,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot, ...@@ -1301,7 +1297,7 @@ pci224_find_pci(struct comedi_device *dev, int bus, int slot,
dev_err(dev->class_dev, "error! no %s found!\n", dev_err(dev->class_dev, "error! no %s found!\n",
thisboard->name); thisboard->name);
} }
return -EIO; return NULL;
} }
static void pci224_report_attach(struct comedi_device *dev, unsigned int irq) static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
...@@ -1488,9 +1484,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1488,9 +1484,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return ret; return ret;
} }
ret = pci224_find_pci(dev, bus, slot, &pci_dev); pci_dev = pci224_find_pci(dev, bus, slot);
if (ret < 0) if (pci_dev == NULL)
return ret; return -EIO;
return pci224_attach_common(dev, pci_dev, it->options); return pci224_attach_common(dev, pci_dev, it->options);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment