static int fwohci_pci_detach(device_t self) { fwohci_softc_t *sc = device_get_softc(self); int s; s = splfw(); if (sc->bsr) fwohci_stop(sc, self); bus_generic_detach(self); if (sc->fc.bdev) { device_delete_child(self, sc->fc.bdev); sc->fc.bdev = NULL; } /* disable interrupts that might have been switched on */ if (sc->bst && sc->bsh) bus_space_write_4(sc->bst, sc->bsh, FWOHCI_INTMASKCLR, OHCI_INT_EN); if (sc->irq_res) { int err; if (sc->ih) { err = bus_teardown_intr(self, sc->irq_res, sc->ih); if (err) device_printf(self, "Could not tear down irq, %d\n", err); #if defined(__DragonFly__) || __FreeBSD_version < 500000 bus_teardown_intr(self, sc->irq_res, sc->ih_cam); bus_teardown_intr(self, sc->irq_res, sc->ih_bio); #endif sc->ih = NULL; } bus_release_resource(self, SYS_RES_IRQ, 0, sc->irq_res); sc->irq_res = NULL; } if (sc->bsr) { bus_release_resource(self, SYS_RES_MEMORY,PCI_CBMEM,sc->bsr); sc->bsr = NULL; sc->bst = 0; sc->bsh = 0; } fwohci_detach(sc, self); mtx_destroy(FW_GMTX(&sc->fc)); splx(s); return 0; }
static int fwohci_pci_detach(device_t self, int flags) { struct fwohci_pci_softc *psc = device_private(self); int rv; pmf_device_deregister(self); rv = fwohci_detach(&psc->psc_sc, flags); if (rv) return rv; if (psc->psc_ih != NULL) { pci_intr_disestablish(psc->psc_pc, psc->psc_ih); psc->psc_ih = NULL; } if (psc->psc_sc.bssize) { bus_space_unmap(psc->psc_sc.bst, psc->psc_sc.bsh, psc->psc_sc.bssize); psc->psc_sc.bssize = 0; } return 0; }