int asmc_detach(struct device *self, int flags) { struct asmc_softc *sc = (struct asmc_softc *)self; int i; wakeup(&sc->sc_sensor_task); sensordev_deinstall(&sc->sc_sensor_dev); if (sc->sc_sensor_task) sensor_task_unregister(sc->sc_sensor_task); for (i = 0; i < ASMC_MAXMOTION; i++) sensor_detach(&sc->sc_sensor_dev, &sc->sc_sensor_motion[i]); for (i = 0; i < ASMC_MAXLIGHT; i++) sensor_detach(&sc->sc_sensor_dev, &sc->sc_sensor_light[i]); for (i = 0; i < ASMC_MAXFAN; i++) sensor_detach(&sc->sc_sensor_dev, &sc->sc_sensor_fan[i]); for (i = 0; i < ASMC_MAXTEMP; i++) sensor_detach(&sc->sc_sensor_dev, &sc->sc_sensor_temp[i]); 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 uoakv_detach(struct device *self, int flags) { struct uoakv_softc *sc = (struct uoakv_softc *)self; struct uoak_softc *scc = &sc->sc_uoak_softc; int i, rv = 0; wakeup(&sc->sc_sensortask); sensordev_deinstall(&sc->sc_sensordev); for (i = 0; i < OAK_V_MAXSENSORS; i++) uoak_sensor_detach(scc, &sc->sc_sensor[i].v); if (sc->sc_sensortask != NULL) sensor_task_unregister(sc->sc_sensortask); if (sc->sc_hdev.sc_state & UHIDEV_OPEN) uhidev_close(&sc->sc_hdev); if (scc->sc_ibuf != NULL) { free(scc->sc_ibuf, M_USBDEV); scc->sc_ibuf = NULL; } return (rv); }
static int km_detach(struct device *dev) { struct km_softc *sc = device_get_softc(dev); sensordev_deinstall(&sc->sc_sensordev); sensor_task_unregister(sc); return 0; }
int owid_detach(struct device *self, int flags) { struct owid_softc *sc = (struct owid_softc *)self; sensordev_deinstall(&sc->sc_sensordev); return (0); }
static int aps_detach(struct device *dev) { struct aps_softc *sc = device_get_softc(dev); sensordev_deinstall(&sc->sensordev); sensor_task_unregister(sc); return bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_iorid, sc->sc_iores); }
int owctr_detach(struct device *self, int flags) { struct owctr_softc *sc = (struct owctr_softc *)self; rw_enter_write(&sc->sc_lock); sensordev_deinstall(&sc->sc_sensordev); if (sc->sc_sensortask != NULL) sensor_task_unregister(sc->sc_sensortask); rw_exit_write(&sc->sc_lock); return (0); }
int lm_detach(struct lm_softc *sc) { int i; /* Remove sensors */ sensordev_deinstall(&sc->sensordev); for (i = 0; i < sc->numsensors; i++) sensor_detach(&sc->sensordev, &sc->sensors[i]); sensor_task_unregister(sc); return 0; }
static int aibs_detach(struct device *dev) { struct aibs_softc *sc = device_get_softc(dev); sensordev_deinstall(&sc->sc_sensordev); sensor_task_unregister(sc); if (sc->sc_asens_volt != NULL) kfree(sc->sc_asens_volt, M_DEVBUF); if (sc->sc_asens_temp != NULL) kfree(sc->sc_asens_temp, M_DEVBUF); if (sc->sc_asens_fan != NULL) kfree(sc->sc_asens_fan, M_DEVBUF); return 0; }
int mstsclose(struct tty *tp, int flags) { struct msts *np = (struct msts *)tp->t_sc; tp->t_line = TTYDISC; /* switch back to termios */ timeout_del(&np->msts_tout); sensordev_deinstall(&np->timedev); free(np, M_DEVBUF); tp->t_sc = NULL; msts_count--; if (msts_count == 0) msts_nxid = 0; return linesw[TTYDISC].l_close(tp, flags); }
int nmeaclose(struct tty *tp, int flags, struct proc *p) { struct nmea *np = (struct nmea *)tp->t_sc; tp->t_line = TTYDISC; /* switch back to termios */ timeout_del(&np->nmea_tout); sensordev_deinstall(&np->timedev); free(np, M_DEVBUF, sizeof(*np)); tp->t_sc = NULL; nmea_count--; if (nmea_count == 0) nmea_nxid = 0; return (linesw[TTYDISC].l_close(tp, flags, p)); }
int endrunclose(struct tty *tp, int flags, struct proc *p) { struct endrun *np = (struct endrun *)tp->t_sc; DPRINTF(("endrunclose\n")); tp->t_line = TTYDISC; /* switch back to termios */ timeout_del(&np->endrun_tout); sensordev_deinstall(&np->timedev); free(np, M_DEVBUF, 0); tp->t_sc = NULL; endrun_count--; if (endrun_count == 0) endrun_nxid = 0; return linesw[TTYDISC].l_close(tp, flags, p); }
int it_detach(struct device *dev) { struct it_softc *sc = device_get_softc(dev); int error; sensordev_deinstall(&sc->sensordev); sensor_task_unregister(sc); error = bus_release_resource(dev, SYS_RES_IOPORT, sc->sc_iorid, sc->sc_iores); if (error) return error; return 0; }
int utwitch_detach(struct device *self, int flags) { struct utwitch_softc *sc = (struct utwitch_softc *)self; int rv = 0; sc->sc_dying = 1; wakeup(&sc->sc_sensortask); sensordev_deinstall(&sc->sc_sensordev); sensor_detach(&sc->sc_sensordev, &sc->sc_sensor_val); sensor_detach(&sc->sc_sensordev, &sc->sc_sensor_delta); if (sc->sc_sensortask != NULL) sensor_task_unregister(sc->sc_sensortask); if (sc->sc_ibuf != NULL) { free(sc->sc_ibuf, M_USBDEV); sc->sc_ibuf = NULL; } return (rv); }
int utwitch_detach(struct device *self, int flags) { struct utwitch_softc *sc = (struct utwitch_softc *)self; int rv = 0; wakeup(&sc->sc_sensortask); sensordev_deinstall(&sc->sc_sensordev); sensor_detach(&sc->sc_sensordev, &sc->sc_sensor_val); sensor_detach(&sc->sc_sensordev, &sc->sc_sensor_delta); if (sc->sc_sensortask != NULL) sensor_task_unregister(sc->sc_sensortask); if (sc->sc_hdev.sc_state & UHIDEV_OPEN) uhidev_close(&sc->sc_hdev); if (sc->sc_ibuf != NULL) { free(sc->sc_ibuf, M_USBDEV, 0); sc->sc_ibuf = NULL; } return (rv); }