int scsibusdetach(struct device *dev, int type) { struct scsibus_softc *sb = (struct scsibus_softc *)dev; int i, j, error; #if NBIO > 0 bio_unregister(&sb->sc_dev); #endif if ((error = config_detach_children(dev, type)) != 0) return (error); for (i = 0; i < sb->sc_buswidth; i++) { if (sb->sc_link[i] != NULL) { for (j = 0; j < sb->adapter_link->luns; j++) { if (sb->sc_link[i][j] != NULL) free(sb->sc_link[i][j], M_DEVBUF); } free(sb->sc_link[i], M_DEVBUF); } } free(sb->sc_link, M_DEVBUF); /* Free shared data. */ scsi_deinit(); return (0); }
int safte_detach(struct device *self, int flags) { struct safte_softc *sc = (struct safte_softc *)self; int i; rw_enter_write(&sc->sc_lock); #if NBIO > 0 if (sc->sc_nslots > 0) bio_unregister(self); #endif if (sc->sc_nsensors > 0) { sensordev_deinstall(&sc->sc_sensordev); sensor_task_unregister(sc->sc_sensortask); for (i = 0; i < sc->sc_nsensors; i++) sensor_detach(&sc->sc_sensordev, &sc->sc_sensors[i].se_sensor); free(sc->sc_sensors, M_DEVBUF); } if (sc->sc_encbuf != NULL) free(sc->sc_encbuf, M_DEVBUF); rw_exit_write(&sc->sc_lock); return (0); }
int scsibusdetach(struct device *dev, int type) { struct scsibus_softc *sb = (struct scsibus_softc *)dev; int error; #if NBIO > 0 bio_unregister(&sb->sc_dev); #endif error = scsi_detach_bus(sb, type); if (error != 0) return (error); KASSERT(SLIST_EMPTY(&sb->sc_link)); return (0); }