static int fe_pccard_attach(device_t dev) { struct fe_softc *sc; const struct fe_pccard_product *pp; int error; /* Prepare for the device probe process. */ sc = device_get_softc(dev); sc->sc_unit = device_get_unit(dev); pp = (const struct fe_pccard_product *) pccard_product_lookup(dev, (const struct pccard_product *)fe_pccard_products, sizeof(fe_pccard_products[0]), NULL); if (pp == NULL) return (ENXIO); if (pp->mpp_flags & MPP_MBH10302) error = fe_probe_mbh(dev, pp); else error = fe_probe_tdk(dev, pp); if (error != 0) { fe_release_resource(dev); return (error); } error = fe_alloc_irq(dev, 0); if (error != 0) { fe_release_resource(dev); return (error); } return (fe_attach(dev)); }
/* * Initialize the device - called from Slot manager. */ static int fe_pccard_probe(device_t dev) { struct fe_softc *sc; int error; /* Prepare for the device probe process. */ sc = device_get_softc(dev); sc->sc_unit = device_get_unit(dev); pccard_get_ether(dev, sc->sc_enaddr); /* Probe for supported cards. */ if ((error = fe_probe_mbh(dev)) == 0) goto end; fe_release_resource(dev); if ((error = fe_probe_tdk(dev)) == 0) goto end; fe_release_resource(dev); end: if (error == 0) error = fe_alloc_irq(dev, 0); fe_release_resource(dev); return (error); }
/* * Initialize the device - called from Slot manager. */ static int fe_pccard_probe(device_t dev) { struct fe_softc *sc; int i, error; uint8_t sum; const uint8_t *ether_addr; /* Prepare for the device probe process. */ sc = device_get_softc(dev); sc->sc_unit = device_get_unit(dev); ether_addr = pccard_get_ether(dev); for (i = 0, sum = 0; i < ETHER_ADDR_LEN; i++) sum |= ether_addr[i]; if (sum) bcopy(ether_addr, sc->sc_enaddr, ETHER_ADDR_LEN); /* Probe for supported cards. */ if ((error = fe_probe_mbh(dev)) == 0) goto end; fe_release_resource(dev); if ((error = fe_probe_tdk(dev)) == 0) goto end; fe_release_resource(dev); end: if (error == 0) error = fe_alloc_irq(dev, 0); fe_release_resource(dev); return (error); }