static bool btbc_suspend(device_t self, const pmf_qual_t *qual) { struct btbc_softc *sc = device_private(self); if (sc->sc_unit) { hci_detach(sc->sc_unit); sc->sc_unit = NULL; } return true; }
static int ubt_detach(device_t self) { struct ubt_softc *sc = device_get_softc(self); DPRINTF("sc=%p \n", sc); sc->sc_dying = 1; if (!sc->sc_ok) return 0; /* Detach HCI interface */ if (sc->sc_unit) { hci_detach(sc->sc_unit); sc->sc_unit = NULL; } /* * Abort all pipes. Causes processes waiting for transfer to wake. * * Actually, hci_detach() above will call ubt_disable() which may * call ubt_abortdealloc(), but lets be sure since doing it twice * wont cause an error. */ ubt_abortdealloc(sc); /* wait for all processes to finish */ if (sc->sc_refcnt-- > 0) usb_detach_wait(sc->sc_dev); if (sc->sysctl_tree != NULL) { sc->sysctl_tree = NULL; sysctl_ctx_free(&sc->sysctl_ctx); } usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev); DPRINTFN(1, "driver detached\n"); return 0; }
/* ARGSUSED */ static int btbc_detach(device_t self, int flags) { struct btbc_softc *sc = device_private(self); int err = 0; pmf_device_deregister(self); btbc_disable(sc->sc_dev); callout_stop(&sc->sc_ledch); callout_destroy(&sc->sc_ledch); if (sc->sc_unit) { hci_detach(sc->sc_unit); sc->sc_unit = NULL; } pcmcia_function_unconfigure(sc->sc_pf); return err; }