diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c --- a/sys/dev/asmc/asmc.c +++ b/sys/dev/asmc/asmc.c @@ -791,23 +791,13 @@ static int asmc_detach(device_t dev) { - struct asmc_softc *sc = device_get_softc(dev); - - if (sc->sc_sms_tq) { - taskqueue_drain(sc->sc_sms_tq, &sc->sc_sms_task); - taskqueue_free(sc->sc_sms_tq); - } - if (sc->sc_cookie) - bus_teardown_intr(dev, sc->sc_irq, sc->sc_cookie); - if (sc->sc_irq) - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_rid_irq, - sc->sc_irq); - if (sc->sc_ioport) - bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_rid_port, - sc->sc_ioport); - mtx_destroy(&sc->sc_mtx); - return (0); + /* + * Prevent module unload to avoid issues with device reprobing + * via acpi_driver_added() which can cause kernel panics when + * accessing freed driver structures. + */ + return (EBUSY); } static int