On Sat, Jan 11, 2020 at 02:57:14AM -0600, Scott Cheloha wrote:
> The sleep duration is in milliseconds.  We can rip out the timeval and
> tvtohz(9) and use MSEC_TO_NSEC() directly instead.  I've added a local
> "msecs" variable because "timo" (a) feels a bit ambiguous and (b) is
> used with different units earlier in the same function.
> 
> [...]

Bump and rebase.

This is a straightforward ticks-to-milliseconds change.  We also kill
off one of the remaining tvtohz(9) calls.

ok?

Index: ips.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ips.c,v
retrieving revision 1.117
diff -u -p -r1.117 ips.c
--- ips.c       14 Feb 2020 18:37:03 -0000      1.117
+++ ips.c       18 Feb 2020 00:21:48 -0000
@@ -1409,8 +1409,7 @@ ips_cmd(struct ips_softc *sc, struct ips
 int
 ips_poll(struct ips_softc *sc, struct ips_ccb *ccb)
 {
-       struct timeval tv;
-       int error, timo;
+       int error, msecs, timo;
 
        splassert(IPL_BIO);
 
@@ -1427,14 +1426,11 @@ ips_poll(struct ips_softc *sc, struct ip
                }
        } else {
                /* sleep */
-               timo = ccb->c_xfer ? ccb->c_xfer->timeout : IPS_TIMEOUT;
-               tv.tv_sec = timo / 1000;
-               tv.tv_usec = (timo % 1000) * 1000;
-               timo = tvtohz(&tv);
+               msecs = ccb->c_xfer ? ccb->c_xfer->timeout : IPS_TIMEOUT;
 
-               DPRINTF(IPS_D_XFER, ("%s: ips_poll: sleep %d hz\n",
-                   sc->sc_dev.dv_xname, timo));
-               tsleep(ccb, PRIBIO + 1, "ipscmd", timo);
+               DPRINTF(IPS_D_XFER, ("%s: ips_poll: sleep %d ms\n",
+                   sc->sc_dev.dv_xname, msecs));
+               tsleep_nsec(ccb, PRIBIO + 1, "ipscmd", MSEC_TO_NSEC(msecs));
        }
        DPRINTF(IPS_D_XFER, ("%s: ips_poll: state %d\n", sc->sc_dev.dv_xname,
            ccb->c_state));

Reply via email to