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: Ian Abbott <abbotti@xxxxxxxxx>
---
drivers/staging/comedi/drivers/amplc_pci224.c | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c
index cd4038a..ad440d6 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -1257,14 +1257,11 @@ static const struct pci224_board
* This function looks for a PCI device matching the requested board name,
* bus and slot.
*/
-static int
-pci224_find_pci(struct comedi_device *dev, int bus, int slot,
- struct pci_dev **pci_dev_p)
+static struct pci_dev *
+pci224_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;
@@ -1291,8 +1288,7 @@ pci224_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) {
@@ -1303,7 +1299,7 @@ pci224_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;
}
static void pci224_report_attach(struct comedi_device *dev, unsigned int irq)
@@ -1490,9 +1486,9 @@ static int pci224_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return ret;
}
- ret = pci224_find_pci(dev, bus, slot, &pci_dev);
- if (ret < 0)
- return ret;
+ pci_dev = pci224_find_pci(dev, bus, slot);
+ if (pci_dev == NULL)
+ return -EIO;
return pci224_attach_common(dev, pci_dev, it->options);
}
--
1.7.8.6
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel
[Video for Linux]
[Mplayer Users]
[Linux USB Devel]
[Linux Audio Users]
[Photos]
[Yosemite Photos]
[Free Singles Community]
[Linux Kernel]
[Linux SCSI]
[XFree86]
[Devices]
[Yosemite Backpacking]