static int ld_virtio_detach(device_t self, int flags) { struct ld_virtio_softc *sc = device_private(self); struct ld_softc *ld = &sc->sc_ld; bus_dma_tag_t dmat = sc->sc_virtio->sc_dmat; int r, i, qsize; qsize = sc->sc_vq.vq_num; r = ldbegindetach(ld, flags); if (r != 0) return r; virtio_reset(sc->sc_virtio); virtio_free_vq(sc->sc_virtio, &sc->sc_vq); for (i = 0; i < qsize; i++) { bus_dmamap_destroy(dmat, sc->sc_reqs[i].vr_cmdsts); bus_dmamap_destroy(dmat, sc->sc_reqs[i].vr_payload); } bus_dmamem_unmap(dmat, sc->sc_reqs, sizeof(struct virtio_blk_req) * qsize); bus_dmamem_free(dmat, &sc->sc_reqs_seg, 1); ldenddetach(ld); return 0; }
static int ld_twa_detach(device_t self, int flags) { struct ld_twa_softc *sc = device_private(self); struct ld_softc *ld = &sc->sc_ld; int error; if ((error = ldbegindetach(ld, flags)) != 0) return (error); ldenddetach(ld); return (0); }
static int ld_sdmmc_detach(device_t dev, int flags) { struct ld_sdmmc_softc *sc = device_private(dev); struct ld_softc *ld = &sc->sc_ld; int rv; if ((rv = ldbegindetach(ld, flags)) != 0) return rv; ldenddetach(ld); return 0; }