static int aibs_attach(struct device *dev) { struct aibs_softc *sc; sc = device_get_softc(dev); sc->sc_dev = dev; sc->sc_ah = acpi_get_handle(dev); strlcpy(sc->sc_sensordev.xname, device_get_nameunit(dev), sizeof(sc->sc_sensordev.xname)); aibs_attach_sif(sc, SENSOR_VOLTS_DC); aibs_attach_sif(sc, SENSOR_TEMP); aibs_attach_sif(sc, SENSOR_FANRPM); if (sc->sc_sensordev.sensors_count == 0) { device_printf(dev, "no sensors found\n"); return ENXIO; } sensor_task_register(sc, aibs_refresh, 5); sensordev_install(&sc->sc_sensordev); return 0; }
void aibs_attach(struct device *parent, struct device *self, void *aux) { struct aibs_softc *sc = (struct aibs_softc *)self; struct acpi_attach_args *aa = aux; sc->sc_acpi = (struct acpi_softc *)parent; sc->sc_devnode = aa->aaa_node; strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname, sizeof(sc->sc_sensordev.xname)); SIMPLEQ_INIT(&sc->sc_sensorlist); aibs_probe(sc); printf("\n"); if (sc->sc_mode) aibs_attach_new(sc); else { aibs_attach_sif(sc, SENSOR_TEMP); aibs_attach_sif(sc, SENSOR_FANRPM); aibs_attach_sif(sc, SENSOR_VOLTS_DC); } if (sc->sc_sensordev.sensors_count == 0) { printf("%s: no sensors found\n", DEVNAME(sc)); return; } sensordev_install(&sc->sc_sensordev); aml_register_notify(sc->sc_devnode, aa->aaa_dev, aibs_notify, sc, ACPIDEV_POLL); }
static int aibs_attach(device_t dev) { struct aibs_softc *sc = device_get_softc(dev); sc->sc_dev = dev; sc->sc_ah = acpi_get_handle(dev); aibs_attach_sif(sc, AIBS_VOLT); aibs_attach_sif(sc, AIBS_TEMP); aibs_attach_sif(sc, AIBS_FAN); return 0; }