Initialize sensors states before registering.

This commit is contained in:
pgoyette 2011-06-20 17:21:50 +00:00
parent 1ccd59cea1
commit 930a8a50f3
4 changed files with 14 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_fan.c,v 1.4 2011/02/16 09:05:12 jruoho Exp $ */
/* $NetBSD: acpi_fan.c,v 1.5 2011/06/20 17:21:50 pgoyette Exp $ */
/*-
* Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi>
@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_fan.c,v 1.4 2011/02/16 09:05:12 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_fan.c,v 1.5 2011/06/20 17:21:50 pgoyette Exp $");
#include <sys/param.h>
#include <sys/module.h>
@ -172,6 +172,7 @@ acpifan_sensor_init(device_t self)
acpifan_sensor_state(self);
sc->sc_sensor.units = ENVSYS_INDICATOR;
sc->sc_sensor.state = ENVSYS_SINVALID;
(void)strlcpy(sc->sc_sensor.desc, "state", sizeof(sc->sc_sensor.desc));

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_pmtr.c,v 1.4 2011/06/03 18:50:36 jruoho Exp $ */
/* $NetBSD: acpi_pmtr.c,v 1.5 2011/06/20 17:21:50 pgoyette Exp $ */
/*-
* Copyright (c) 2011 Jukka Ruohonen <jruohonen@iki.fi>
@ -27,7 +27,7 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_pmtr.c,v 1.4 2011/06/03 18:50:36 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_pmtr.c,v 1.5 2011/06/20 17:21:50 pgoyette Exp $");
#include <sys/param.h>
#include <sys/module.h>
@ -338,6 +338,8 @@ acpipmtr_sensor_init(device_t self)
sc->sc_sensor_o.units = ENVSYS_SWATTS;
sc->sc_sensor_i.value_cur = val * 1000;
sc->sc_sensor_o.value_cur = val * 1000;
sc->sc_sensor_i.state = ENVSYS_SINVALID;
sc->sc_sensor_o.state = ENVSYS_SINVALID;
acpipmtr_sensor_type(self);

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_tz.c,v 1.81 2011/06/20 15:36:49 jruoho Exp $ */
/* $NetBSD: acpi_tz.c,v 1.82 2011/06/20 17:21:50 pgoyette Exp $ */
/*
* Copyright (c) 2003 Jared D. McNeill <jmcneill@invisible.ca>
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.81 2011/06/20 15:36:49 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.82 2011/06/20 17:21:50 pgoyette Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -774,6 +774,7 @@ acpitz_init_envsys(device_t dv)
sc->sc_temp_sensor.flags = flags;
sc->sc_temp_sensor.units = ENVSYS_STEMP;
sc->sc_temp_sensor.state = ENVSYS_SINVALID;
(void)strlcpy(sc->sc_temp_sensor.desc, "temperature",
sizeof(sc->sc_temp_sensor.desc));
@ -785,6 +786,7 @@ acpitz_init_envsys(device_t dv)
sc->sc_fan_sensor.flags = flags;
sc->sc_fan_sensor.units = ENVSYS_SFANRPM;
sc->sc_fan_sensor.state = ENVSYS_SINVALID;
(void)strlcpy(sc->sc_fan_sensor.desc,
"FAN", sizeof(sc->sc_fan_sensor.desc));

View File

@ -1,4 +1,4 @@
/* $NetBSD: aibs_acpi.c,v 1.1 2011/06/12 07:25:43 jruoho Exp $ */
/* $NetBSD: aibs_acpi.c,v 1.2 2011/06/20 17:21:50 pgoyette Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@ -47,7 +47,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aibs_acpi.c,v 1.1 2011/06/12 07:25:43 jruoho Exp $");
__KERNEL_RCSID(0, "$NetBSD: aibs_acpi.c,v 1.2 2011/06/20 17:21:50 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -465,6 +465,7 @@ aibs_sensor_add(device_t self, ACPI_OBJECT *obj)
}
(void)strlcpy(as->as_sensor.desc, name, sizeof(as->as_sensor.desc));
as->as_sensor.state = ENVSYS_SINVALID;
if (sysmon_envsys_sensor_attach(sc->sc_sme, &as->as_sensor) != 0) {
rv = AE_AML_INTERNAL;