WRAP/lmtemp(4) testers needed

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

WRAP/lmtemp(4) testers needed

Mark Kettenis
Hi,

Recently a new mechanism to update sensors was introduced in OpenBSD.
Here's a patch that cuts lmtemp(4) over to that new mechanism, such
that it can be used on more platforms.  If you own a WRAP board with
an lmtemp(4) sensor, please test the attached patch.  You'll need a
very up to date -current tree to be able to build a kernel with this
patch.  Please check with "sysctl hw.sensors" whether the sensor value
is still updated correctly.

Thanks,

Mark

Index: lm75.c
===================================================================
RCS file: /cvs/src/sys/dev/i2c/lm75.c,v
retrieving revision 1.1
diff -u -p -r1.1 lm75.c
--- lm75.c 23 May 2004 18:12:37 -0000 1.1
+++ lm75.c 11 Nov 2005 12:39:35 -0000
@@ -60,7 +60,6 @@
 #include <sys/device.h>
 #include <sys/kernel.h>
 #include <sys/sensors.h>
-#include <sys/timeout.h>
 
 #include <dev/i2c/i2cvar.h>
 #include <dev/i2c/lm75reg.h>
@@ -72,7 +71,6 @@ struct lmtemp_softc {
  int sc_model;
 
  struct sensor sc_sensor;
- struct timeout sc_timeout;
 };
 
 int  lmtemp_match(struct device *, void *, void *);
@@ -149,9 +147,7 @@ lmtemp_attach(struct device *parent, str
  /* Hook into the hw.sensors sysctl */
  SENSOR_ADD(&sc->sc_sensor);
 
- /* Set poll timer */
- timeout_set(&sc->sc_timeout, lmtemp_refresh_sensor_data, sc);
- timeout_add(&sc->sc_timeout, LM_POLLTIME);
+ sensor_task_register(sc, lmtemp_refresh_sensor_data, LM_POLLTIME);
 }
 
 int
@@ -215,6 +211,4 @@ lmtemp_refresh_sensor_data(void *aux)
 
  sc->sc_sensor.value = val * 500000 + 273150000;
  sc->sc_sensor.flags &= ~SENSOR_FINVALID;
-
- timeout_add(&sc->sc_timeout, LM_POLLTIME);
 }
Index: lm75reg.h
===================================================================
RCS file: /cvs/src/sys/dev/i2c/lm75reg.h,v
retrieving revision 1.1
diff -u -p -r1.1 lm75reg.h
--- lm75reg.h 23 May 2004 18:12:37 -0000 1.1
+++ lm75reg.h 11 Nov 2005 12:39:35 -0000
@@ -57,7 +57,7 @@
 #define LM_MODEL_LM75 1
 #define LM_MODEL_LM77 2
 
-#define LM_POLLTIME (hz * 2) /* 2s */
+#define LM_POLLTIME 2 /* 2s */
 
 /*
  * LM75 temperature sensor I2C address: