`delay' is expressed in ms, however since tsleep_nsec(9) doesn't add a
tick the conversions below might result in shorter sleeps.  I'd
appreciate if uthum(4) owners could test this diff and report back.

Index: uthum.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uthum.c,v
retrieving revision 1.32
diff -u -p -r1.32 uthum.c
--- uthum.c     9 Jan 2017 14:44:28 -0000       1.32
+++ uthum.c     1 Jan 2020 14:27:59 -0000
@@ -311,7 +311,8 @@ uthum_issue_cmd(struct uthum_softc *sc, 
 
        /* wait if required */
        if (delay > 0)
-               tsleep(&sc->sc_sensortask, 0, "uthum", (delay*hz+999)/1000 + 1);
+               tsleep_nsec(&sc->sc_sensortask, 0, "uthum",
+                   MSEC_TO_NSEC(delay));
 
        return 0;
 }
@@ -337,7 +338,8 @@ uthum_read_data(struct uthum_softc *sc, 
 
        /* wait if required */
        if (delay > 0)
-               tsleep(&sc->sc_sensortask, 0, "uthum", (delay*hz+999)/1000 + 1);
+               tsleep_nsec(&sc->sc_sensortask, 0, "uthum",
+                   MSEC_TO_NSEC(delay));
 
        /* get answer */
        if (uhidev_get_report(sc->sc_hdev.sc_parent, UHID_FEATURE_REPORT,

Reply via email to