Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318113
b: refs/heads/master
c: 5d30e51
h: refs/heads/master
i:
  318111: 7b11dd6
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 19, 2012
1 parent ad2bb89 commit a11fca8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 42 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1f20b973f68346af2712e5d014932d984b6f5387
refs/heads/master: 5d30e51909b61916744e45d3c50cf42569c92c20
58 changes: 17 additions & 41 deletions trunk/drivers/staging/comedi/drivers/dyna_pci10xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,55 +233,31 @@ static struct pci_dev *dyna_pci10xx_find_pci_dev(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct pci_dev *pcidev = NULL;
int opt_bus = it->options[0];
int opt_slot = it->options[1];
int board_index;
int bus = it->options[0];
int slot = it->options[1];
int i;

for (pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, NULL);
pcidev != NULL;
pcidev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pcidev)) {

board_index = -1;
for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) {
if ((pcidev->vendor == PCI_VENDOR_ID_DYNALOG) &&
(pcidev->device == boardtypes[i].device_id)) {
board_index = i;
break;
}
for_each_pci_dev(pcidev) {
if (bus || slot) {
if (bus != pcidev->bus->number ||
slot != PCI_SLOT(pcidev->devfn))
continue;
}
if (board_index < 0)
if (pcidev->vendor != PCI_VENDOR_ID_DYNALOG)
continue;

/* Found matching vendor/device. */
if (opt_bus || opt_slot) {
/* Check bus/slot. */
if (opt_bus != pcidev->bus->number
|| opt_slot != PCI_SLOT(pcidev->devfn))
continue; /* no match */
}

goto found;
}
printk(KERN_ERR "comedi: dyna_pci10xx: no supported device found!\n");
return NULL;

found:
for (i = 0; i < ARRAY_SIZE(boardtypes); ++i) {
if (pcidev->device != boardtypes[i].device_id)
continue;

if (!pcidev) {
if (opt_bus || opt_slot) {
printk(KERN_ERR "comedi: dyna_pci10xx: "
"invalid PCI device at b:s %d:%d\n",
opt_bus, opt_slot);
} else {
printk(KERN_ERR "comedi: dyna_pci10xx: "
"invalid PCI device\n");
dev->board_ptr = &boardtypes[i];
return pcidev;
}
return NULL;
}

dev->board_ptr = &boardtypes[board_index];
return pcidev;
dev_err(dev->class_dev,
"No supported board found! (req. bus %d, slot %d)\n",
bus, slot);
return NULL;
}

static int dyna_pci10xx_attach(struct comedi_device *dev,
Expand Down

0 comments on commit a11fca8

Please sign in to comment.