cz(4) is apparently not compiled, but it keeps showing up in my symbol
searches, so I'll just convert it to reduce noise.

Here the code is converting CZ_POLL_MS to ticks.  We can just use that
constant directly with timeout_add_msec(9).  We then don't need the
cz_timeout_ticks variable at all.

Then we have a 10ms sleep.  mpi@ already got the other 1-second sleep
in a prior pass.

ok?

Index: pci/cz.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/cz.c,v
retrieving revision 1.22
diff -u -p -r1.22 cz.c
--- pci/cz.c    9 Jan 2020 14:35:19 -0000       1.22
+++ pci/cz.c    10 Jan 2020 23:35:44 -0000
@@ -181,7 +181,6 @@ struct      cztty_softc * cztty_getttysoftc(d
 int    cztty_findmajor(void);
 int    cztty_major;
 int    cztty_attached_ttys;
-int    cz_timeout_ticks;
 
 cdev_decl(cztty);
 
@@ -362,11 +361,8 @@ cz_attach(parent, self, aux)
  polling_mode:
        if (cz->cz_ih == NULL) {
                timeout_set(&cz->cz_timeout, cz_poll, cz);
-               if (cz_timeout_ticks == 0)
-                       cz_timeout_ticks = max(1, hz * CZ_POLL_MS / 1000);
-               printf("%s: polling mode, %d ms interval (%d tick%s)\n",
-                   cz->cz_dev.dv_xname, CZ_POLL_MS, cz_timeout_ticks,
-                   cz_timeout_ticks == 1 ? "" : "s");
+               printf("%s: polling mode, %d ms interval\n",
+                   cz->cz_dev.dv_xname, CZ_POLL_MS);
        }
 
        if (cztty_major == 0)
@@ -667,7 +663,7 @@ cz_poll(void *arg)
        struct cz_softc *cz = arg;
 
        cz_intr(cz);
-       timeout_add(&cz->cz_timeout, cz_timeout_ticks);
+       timeout_add_msec(&cz->cz_timeout, MSEC_TO_NSEC(CZ_POLL_MS));
 
        splx(s);
 }
@@ -825,7 +821,8 @@ cz_wait_pci_doorbell(struct cz_softc *cz
        int     error;
 
        while (CZ_PLX_READ(cz, PLX_PCI_LOCAL_DOORBELL)) {
-               error = tsleep(cz, TTIPRI | PCATCH, wstring, max(1, hz/100));
+               error = tsleep_nsec(cz, TTIPRI | PCATCH, wstring,
+                   MSEC_TO_NSEC(10));
                if ((error != 0) && (error != EWOULDBLOCK))
                        return (error);
        }
@@ -983,7 +980,8 @@ czttyopen(dev_t dev, int flags, int mode
                        printf("%s: Enabling polling.\n",
                            cz->cz_dev.dv_xname);
 #endif
-                       timeout_add(&cz->cz_timeout, cz_timeout_ticks);
+                       timeout_add_msec(&cz->cz_timeout,
+                           MSEC_TO_NSEC(CZ_POLL_MS));
                }
 
                /*

Reply via email to