Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318057
b: refs/heads/master
c: 3dbd666
h: refs/heads/master
i:
  318055: cc8c7fc
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 19, 2012
1 parent ab79e15 commit 7597708
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 47 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: 05979c7b3c5463eddbbfd3dd56f8a62679508c5e
refs/heads/master: 3dbd666ca4e3c6e6d19101781a62555d0210ff57
63 changes: 17 additions & 46 deletions trunk/drivers/staging/comedi/drivers/adv_pci1723.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,59 +290,30 @@ static int pci1723_dio_insn_bits(struct comedi_device *dev,
static struct pci_dev *pci1723_find_pci_dev(struct comedi_device *dev,
struct comedi_devconfig *it)
{
struct pci_dev *pcidev;
unsigned int iobase;
unsigned char pci_bus, pci_slot, pci_func;
int opt_bus, opt_slot;
const char *errstr;

opt_bus = it->options[0];
opt_slot = it->options[1];

/* Look for matching PCI device */
errstr = "not found!";
pcidev = NULL;
while (NULL != (pcidev =
pci_get_device(PCI_VENDOR_ID_ADVANTECH,
this_board->device_id, pcidev))) {
/* 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 */
struct pci_dev *pcidev = NULL;
int bus = it->options[0];
int slot = it->options[1];

for_each_pci_dev(pcidev) {
if (bus || slot) {
if (bus != pcidev->bus->number ||
slot != PCI_SLOT(pcidev->devfn))
continue;
}
if (pcidev->vendor != PCI_VENDOR_ID_ADVANTECH)
continue;
/*
* Look for device that isn't in use.
* Enable PCI device and request regions.
*/
if (comedi_pci_enable(pcidev, "adv_pci1723")) {
errstr =
"failed to enable PCI device and request regions!";
if (comedi_pci_enable(pcidev, "adv_pci1723"))
continue;
}
break;
}

if (!pcidev) {
if (opt_bus || opt_slot) {
printk(KERN_ERR " - Card at b:s %d:%d %s\n",
opt_bus, opt_slot, errstr);
} else {
printk(KERN_ERR " - Card %s\n", errstr);
}
return NULL;
return pcidev;
}

pci_bus = pcidev->bus->number;
pci_slot = PCI_SLOT(pcidev->devfn);
pci_func = PCI_FUNC(pcidev->devfn);
iobase = pci_resource_start(pcidev, 2);

printk(KERN_ERR ", b:s:f=%d:%d:%d, io=0x%4x",
pci_bus, pci_slot, pci_func, iobase);

return pcidev;
dev_err(dev->class_dev,
"No supported board found! (req. bus %d, slot %d)\n",
bus, slot);
return NULL;
}

static int pci1723_attach(struct comedi_device *dev,
Expand Down

0 comments on commit 7597708

Please sign in to comment.