Cache PCI vendor/device ids to avoid unnecessary PCI configuration

space access in device probe.
Also nuke referencing softc in device probe.
This commit is contained in:
Pyun YongHyeon 2008-07-29 08:49:36 +00:00
parent be280562a1
commit 2229ae4a5e

View File

@ -171,17 +171,14 @@ static int
bfe_probe(device_t dev) bfe_probe(device_t dev)
{ {
struct bfe_type *t; struct bfe_type *t;
struct bfe_softc *sc; uint16_t vendor, devid;
t = bfe_devs; t = bfe_devs;
vendor = pci_get_vendor(dev);
sc = device_get_softc(dev); devid = pci_get_device(dev);
bzero(sc, sizeof(struct bfe_softc));
sc->bfe_dev = dev;
while(t->bfe_name != NULL) { while(t->bfe_name != NULL) {
if ((pci_get_vendor(dev) == t->bfe_vid) && if (vendor == t->bfe_vid && devid == t->bfe_did) {
(pci_get_device(dev) == t->bfe_did)) {
device_set_desc_copy(dev, t->bfe_name); device_set_desc_copy(dev, t->bfe_name);
return (BUS_PROBE_DEFAULT); return (BUS_PROBE_DEFAULT);
} }