There's no need to use another envsys_data_t pointer that points to

sme->sme_sensor_data again, just use the edata pointer passed in
the gtredata function.
This commit is contained in:
xtraeme 2007-07-01 11:28:14 +00:00
parent 2efc038f73
commit 777c61efe0
2 changed files with 13 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: adm1030.c,v 1.8 2007/07/01 07:37:14 xtraeme Exp $ */ /* $NetBSD: adm1030.c,v 1.9 2007/07/01 11:28:14 xtraeme Exp $ */
/*- /*-
* Copyright (C) 2005 Michael Lorenz. * Copyright (C) 2005 Michael Lorenz.
@ -33,7 +33,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: adm1030.c,v 1.8 2007/07/01 07:37:14 xtraeme Exp $"); __KERNEL_RCSID(0, "$NetBSD: adm1030.c,v 1.9 2007/07/01 11:28:14 xtraeme Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -257,28 +257,26 @@ static int
adm1030c_gtredata(struct sysmon_envsys *sme, envsys_data_t *edata) adm1030c_gtredata(struct sysmon_envsys *sme, envsys_data_t *edata)
{ {
struct adm1030c_softc *sc = sme->sme_cookie; struct adm1030c_softc *sc = sme->sme_cookie;
envsys_data_t *cur_tre;
int i; int i;
uint8_t reg; uint8_t reg;
i = edata->sensor; i = edata->sensor;
cur_tre = &sme->sme_sensor_data[i];
reg = sc->regs[i]; reg = sc->regs[i];
switch (cur_tre->units) switch (edata->units)
{ {
case ENVSYS_STEMP: case ENVSYS_STEMP:
cur_tre->value_cur = edata->value_cur =
adm1030c_temp2muk(adm1030c_readreg(sc, reg)); adm1030c_temp2muk(adm1030c_readreg(sc, reg));
break; break;
case ENVSYS_SFANRPM: case ENVSYS_SFANRPM:
{ {
uint8_t blah = adm1030c_readreg(sc,reg); uint8_t blah = adm1030c_readreg(sc,reg);
cur_tre->value_cur = adm1030c_reg2rpm(blah); edata->value_cur = adm1030c_reg2rpm(blah);
} }
break; break;
} }
cur_tre->state = ENVSYS_SVALID; edata->state = ENVSYS_SVALID;
return 0; return 0;
} }
#endif /* NSYSMON_ENVSYS > 0 */ #endif /* NSYSMON_ENVSYS > 0 */

View File

@ -1,4 +1,4 @@
/* $NetBSD: adt7467.c,v 1.7 2007/07/01 07:37:15 xtraeme Exp $ */ /* $NetBSD: adt7467.c,v 1.8 2007/07/01 11:28:14 xtraeme Exp $ */
/*- /*-
* Copyright (C) 2005 Michael Lorenz * Copyright (C) 2005 Michael Lorenz
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: adt7467.c,v 1.7 2007/07/01 07:37:15 xtraeme Exp $"); __KERNEL_RCSID(0, "$NetBSD: adt7467.c,v 1.8 2007/07/01 11:28:14 xtraeme Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -269,24 +269,22 @@ int
adt7467c_gtredata(struct sysmon_envsys *sme, envsys_data_t *edata) adt7467c_gtredata(struct sysmon_envsys *sme, envsys_data_t *edata)
{ {
struct adt7467c_softc *sc=sme->sme_cookie; struct adt7467c_softc *sc=sme->sme_cookie;
envsys_data_t *cur_data;
int i; int i;
uint8_t reg; uint8_t reg;
i = edata->sensor; i = edata->sensor;
cur_data = &sme->sme_sensor_data[i];
reg = sc->regs[i]; reg = sc->regs[i];
switch (cur_data->units) switch (edata->units)
{ {
case ENVSYS_STEMP: case ENVSYS_STEMP:
cur_data->value_cur = edata->value_cur =
temp2muk(adt7467c_readreg(sc, reg)); temp2muk(adt7467c_readreg(sc, reg));
break; break;
case ENVSYS_SVOLTS_DC: case ENVSYS_SVOLTS_DC:
{ {
uint32_t vr = adt7467c_readreg(sc, reg); uint32_t vr = adt7467c_readreg(sc, reg);
cur_data->value_cur = edata->value_cur =
(int)((vr * 2500000) / 0xc0); (int)((vr * 2500000) / 0xc0);
} }
break; break;
@ -297,11 +295,11 @@ adt7467c_gtredata(struct sysmon_envsys *sme, envsys_data_t *edata)
blah = (((uint16_t)adt7467c_readreg(sc, reg)) | blah = (((uint16_t)adt7467c_readreg(sc, reg)) |
((uint16_t)adt7467c_readreg(sc, reg + 1) << ((uint16_t)adt7467c_readreg(sc, reg + 1) <<
8)); 8));
cur_data->value_cur = reg2rpm(blah); edata->value_cur = reg2rpm(blah);
} }
break; break;
} }
cur_data->state = ENVSYS_SVALID; edata->state = ENVSYS_SVALID;
return 0; return 0;
} }
#endif /* NSYSMON_ENVSYS > 0 */ #endif /* NSYSMON_ENVSYS > 0 */