int snc_shutdown(device_t dev) { struct snc_softc *sc = device_get_softc(dev); SNC_LOCK(sc); sncshutdown(sc); SNC_UNLOCK(sc); return (0); }
/* * snc_pccard_detach - 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 snc_pccard_detach(device_t dev) { struct snc_softc *sc = device_get_softc(dev); struct ifnet *ifp = &sc->sc_if; if (sc->gone) { device_printf(dev, "already unloaded\n"); return (0); } sncshutdown(sc); ifp->if_flags &= ~IFF_RUNNING; if_detach(ifp); sc->gone = 1; bus_teardown_intr(dev, sc->irq, sc->irq_handle); snc_release_resources(dev); return (0); }
/* * snc_pccard_detach - detach this instance from the device. */ static int snc_pccard_detach(device_t dev) { struct snc_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->sc_ifp; if (sc->gone) { device_printf(dev, "already unloaded\n"); return (0); } SNC_LOCK(sc); sncshutdown(sc); SNC_UNLOCK(sc); callout_drain(&sc->sc_timer); ether_ifdetach(ifp); sc->gone = 1; bus_teardown_intr(dev, sc->irq, sc->irq_handle); snc_release_resources(dev); mtx_destroy(&sc->sc_lock); return (0); }