/* * feunload - unload the driver and clear the table. * XXX TODO: * This is usually called when the card is ejected, but * can be caused by a modunload of a controller driver. * The idea is to reset the driver's view of the device * and ensure that any driver entry points such as * read and write do not hang. */ static int fe_pccard_detach(device_t dev) { struct fe_softc *sc = device_get_softc(dev); struct ifnet *ifp = &sc->arpcom.ac_if; fe_stop(sc); ether_ifdetach(ifp); bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); fe_release_resource(dev); return 0; }
/* * feunload - unload the driver and clear the table. */ static int fe_pccard_detach(device_t dev) { struct fe_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->ifp; FE_LOCK(sc); fe_stop(sc); FE_UNLOCK(sc); callout_drain(&sc->timer); ether_ifdetach(ifp); bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); if_free(ifp); fe_release_resource(dev); mtx_destroy(&sc->lock); return 0; }