int rtw_cardbus_detach(struct device *self, int flags) { struct rtw_cardbus_softc *csc = (void *)self; struct rtw_softc *sc = &csc->sc_rtw; struct rtw_regs *regs = &sc->sc_regs; struct cardbus_devfunc *ct = csc->sc_ct; int rv; #if defined(DIAGNOSTIC) if (ct == NULL) panic("%s: data structure lacks", sc->sc_dev.dv_xname); #endif rv = rtw_detach(sc); if (rv) return (rv); rtw_cardbus_funcregen(regs, 0); /* * Unhook the interrupt handler. */ if (csc->sc_ih != NULL) cardbus_intr_disestablish(ct->ct_cc, ct->ct_cf, csc->sc_ih); /* * Release bus space and close window. */ if (csc->sc_bar_reg != 0) Cardbus_mapreg_unmap(ct, csc->sc_bar_reg, regs->r_bt, regs->r_bh, csc->sc_mapsize); return (0); }
static int rtw_pci_detach(device_t dev) { struct rtw_softc *sc = device_get_softc(dev); struct rtw_regs *regs = &sc->sc_regs; if (device_is_attached(dev)) rtw_detach(dev); if (regs->r_res != NULL) { bus_release_resource(dev, regs->r_type, regs->r_rid, regs->r_res); } return 0; }
int rtw_pci_detach(struct device *self, int flags) { struct rtw_pci_softc *psc = (void *)self; struct rtw_softc *sc = &psc->psc_rtw; struct rtw_regs *regs = &sc->sc_regs; int rv; rv = rtw_detach(sc); if (rv) return (rv); if (psc->psc_intrcookie != NULL) pci_intr_disestablish(psc->psc_pc, psc->psc_intrcookie); bus_space_unmap(regs->r_bt, regs->r_bh, psc->psc_mapsize); return (0); }