Regards,
Jeff
typedef int (*pci_simple_probe_callback) (struct pci_dev *dev, int
match_num,
void *dev_data, void *drvr_data);
struct pci_simple_probe_entry {
unsigned short vendor; /* vendor id, PCI_ANY_ID, or 0 for last entry */
unsigned short device; /* device id, PCI_ANY_ID, or 0 for last entry */
void *dev_data; /* driver-private, entry-specific data */
};
int pci_simple_probe (struct pci_simple_probe_entry *list, size_t
match_limit,
pci_simple_probe_callback cb, void *drvr_data)
{
struct pci_dev *dev;
struct pci_simple_probe_entry *ent;
size_t matches = 0;
if (!list || !cb)
return -ENODEV;
dev = pci_find_device (PCI_ANY_ID, PCI_ANY_ID, NULL);
while (dev) {
ent = list;
while (ent->vendor && ent->device) {
if (((PCI_ANY_ID != ent->vendor) &&
(dev->vendor != ent->vendor)) ||
((PCI_ANY_ID != ent->vendor) &&
(dev->device != ent->device)))
continue;
int rc = (* cb) (dev, matches, ent->dev_data,
drvr_data);
if (rc < 0)
return rc;
matches++;
if (match_limit && match_limit == matches)
return matches;
ent++;
}
dev = pci_find_device (PCI_ANY_ID, PCI_ANY_ID, dev);
}
return matches;
}
-- Custom driver development | Never worry about theory as long Open source programming | as the machinery does what it's | supposed to do. -- R. A. Heinlein- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/