ihidev(4): tsleep(9) -> tsleep_nsec(9)

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

ihidev(4): tsleep(9) -> tsleep_nsec(9)

Scott Cheloha
Ticks to milliseconds.

ok?

Index: i2c/ihidev.c
===================================================================
RCS file: /cvs/src/sys/dev/i2c/ihidev.c,v
retrieving revision 1.21
diff -u -p -r1.21 ihidev.c
--- i2c/ihidev.c 31 Jul 2019 16:09:12 -0000 1.21
+++ i2c/ihidev.c 23 Jan 2020 02:00:25 -0000
@@ -74,8 +74,6 @@ int ihidev_maxrepid(void *buf, int len);
 int ihidev_print(void *aux, const char *pnp);
 int ihidev_submatch(struct device *parent, void *cf, void *aux);
 
-extern int hz;
-
 struct cfattach ihidev_ca = {
  sizeof(struct ihidev_softc),
  ihidev_match,
@@ -264,15 +262,10 @@ ihidev_activate(struct device *self, int
 void
 ihidev_sleep(struct ihidev_softc *sc, int ms)
 {
- int to = ms * hz / 1000;
-
  if (cold)
  delay(ms * 1000);
- else {
- if (to <= 0)
- to = 1;
- tsleep(&sc, PWAIT, "ihidev", to);
- }
+ else
+ tsleep_nsec(&sc, PWAIT, "ihidev", MSEC_TO_NSEC(ms));
 }
 
 int