Who knew we had a driver for something like this?  :)

This is a ticks -> milliseconds conversion.

ok?

Index: utwitch.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/utwitch.c,v
retrieving revision 1.17
diff -u -p -r1.17 utwitch.c
--- utwitch.c   8 Apr 2017 02:57:25 -0000       1.17
+++ utwitch.c   23 Nov 2019 17:52:49 -0000
@@ -278,7 +278,7 @@ utwitch_set_mode(struct utwitch_softc *s
        }
 
        /* wait ack */
-       tsleep(&sc->sc_sensortask, 0, "utwitch", (1000*hz+999)/1000 + 1);
+       tsleep_nsec(&sc->sc_sensortask, 0, "utwitch", MSEC_TO_NSEC(1000));
 }
 
 void
@@ -296,7 +296,7 @@ utwitch_read_value_request(struct utwitc
                return;
 
        /* wait till sensor data are updated, 500ms will be enough */
-       tsleep(&sc->sc_sensortask, 0, "utwitch", (500*hz+999)/1000 + 1);
+       tsleep_nsec(&sc->sc_sensortask, 0, "utwitch", MSEC_TO_NSEC(500));
 }
 
 void
@@ -319,5 +319,5 @@ utwitch_write_value_request(struct utwit
                return;
 
        /* wait till sensor data are updated, 250ms will be enough */
-       tsleep(&sc->sc_sensortask, 0, "utwitch", (250*hz+999)/1000 + 1);
+       tsleep_nsec(&sc->sc_sensortask, 0, "utwitch", MSEC_TO_NSEC(250));
 }

Reply via email to