Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 318104
b: refs/heads/master
c: f34ec80
h: refs/heads/master
v: v3
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jul 19, 2012
1 parent d138b94 commit a8657c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 37 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: 6896ddfa109b32bef1892a3cbeb5c90d78d568c5
refs/heads/master: f34ec8002b685e865e26c384887b90149949c5bf
56 changes: 20 additions & 36 deletions trunk/drivers/staging/comedi/drivers/daqboard2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,10 @@ Configuration options:

#include "8255.h"

#define DAQBOARD2000_SUBSYSTEM_IDS2 0x00021616 /* Daqboard/2000 - 2 Dacs */
#define DAQBOARD2000_SUBSYSTEM_IDS4 0x00041616 /* Daqboard/2000 - 4 Dacs */
#define PCI_VENDOR_ID_IOTECH 0x1616

#define DAQBOARD2000_SUBSYSTEM_IDS2 0x0002 /* Daqboard/2000 - 2 Dacs */
#define DAQBOARD2000_SUBSYSTEM_IDS4 0x0004 /* Daqboard/2000 - 4 Dacs */

#define DAQBOARD2000_DAQ_SIZE 0x1002
#define DAQBOARD2000_PLX_SIZE 0x100
Expand Down Expand Up @@ -709,47 +711,29 @@ static struct pci_dev *daqboard2000_find_pci_dev(struct comedi_device *dev,
struct pci_dev *pcidev = NULL;
int bus = it->options[0];
int slot = it->options[1];
int i;

for (pcidev = pci_get_device(0x1616, 0x0409, NULL);
pcidev != NULL; pcidev = pci_get_device(0x1616, 0x0409, pcidev)) {
for_each_pci_dev(pcidev) {
if (bus || slot) {
/* requested particular bus/slot */
if (pcidev->bus->number != bus ||
PCI_SLOT(pcidev->devfn) != slot) {
if (bus != pcidev->bus->number ||
slot != PCI_SLOT(pcidev->devfn))
continue;
}
}
break; /* found one */
}
if (!pcidev) {
if (bus || slot)
dev_err(dev->class_dev,
"no daqboard2000 found at bus/slot: %d/%d\n",
bus, slot);
else
dev_err(dev->class_dev, "no daqboard2000 found\n");
return NULL;
} else {
u32 id;
int i;
if (pcidev->vendor != PCI_VENDOR_ID_IOTECH ||
pcidev->device != 0x0409)
continue;

id = ((u32) pcidev->
subsystem_device << 16) | pcidev->subsystem_vendor;
for (i = 0; i < ARRAY_SIZE(boardtypes); i++) {
if (boardtypes[i].id == id) {
dev_dbg(dev->class_dev, "%s\n",
boardtypes[i].name);
dev->board_ptr = boardtypes + i;
}
}
if (!dev->board_ptr) {
printk
(" unknown subsystem id %08x (pretend it is an ids2)",
id);
dev->board_ptr = boardtypes;
if (boardtypes[i].id != pcidev->subsystem_device)
continue;
dev->board_ptr = boardtypes + i;
return pcidev;
}
return pcidev;
}
dev_err(dev->class_dev,
"No supported board found! (req. bus %d, slot %d)\n",
bus, slot);
return NULL;
}

static int daqboard2000_attach(struct comedi_device *dev,
Expand Down Expand Up @@ -886,7 +870,7 @@ static void __devexit daqboard2000_pci_remove(struct pci_dev *dev)
}

static DEFINE_PCI_DEVICE_TABLE(daqboard2000_pci_table) = {
{ PCI_DEVICE(0x1616, 0x0409) },
{ PCI_DEVICE(PCI_VENDOR_ID_IOTECH, 0x0409) },
{ 0 }
};
MODULE_DEVICE_TABLE(pci, daqboard2000_pci_table);
Expand Down

0 comments on commit a8657c4

Please sign in to comment.