Here's another tsleep(9) -> tsleep_nsec(9) conversion.

The first chunk is easy: ticks to seconds.

The second chunk looks fishy, though.

aac_wait_command() calls tsleep(9) with a timeout in ticks, but the
only caller of aac_wait_command() uses a scsi_xfer.timeout as the
timeout, and if I'm reading scsiconf.h correctly scsi_xfer.timeout is
in milliseconds.

Is this a typo?  What is the intended unit for aac_wait_intr()?

Related: can scsi_xfer.timeout be zero?

Index: ic/aac.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/aac.c,v
retrieving revision 1.71
diff -u -p -r1.71 aac.c
--- ic/aac.c    5 Oct 2019 20:41:27 -0000       1.71
+++ ic/aac.c    15 Jan 2020 01:03:21 -0000
@@ -573,8 +573,8 @@ aac_command_thread(void *arg)
                                    ("%s: command thread sleeping\n",
                                     sc->aac_dev.dv_xname));
                        AAC_LOCK_RELEASE(&sc->aac_io_lock);
-                       retval = tsleep(sc->aifthread, PRIBIO, "aifthd",
-                                       AAC_PERIODIC_INTERVAL * hz);
+                       retval = tsleep_nsec(sc->aifthread, PRIBIO, "aifthd",
+                           SEC_TO_NSEC(AAC_PERIODIC_INTERVAL));
                        AAC_LOCK_ACQUIRE(&sc->aac_io_lock);
                }
 
@@ -844,7 +844,7 @@ aac_bio_complete(struct aac_command *cm)
  *     spam the memory of a command that has been recycled.
  */
 int
-aac_wait_command(struct aac_command *cm, int timeout)
+aac_wait_command(struct aac_command *cm, int msecs)
 {
        struct aac_softc *sc = cm->cm_sc;
        int error = 0;
@@ -860,7 +860,7 @@ aac_wait_command(struct aac_command *cm,
                AAC_DPRINTF(AAC_D_MISC, ("%s: sleeping until command done\n",
                                         sc->aac_dev.dv_xname));
                AAC_LOCK_RELEASE(&sc->aac_io_lock);
-               error = tsleep(cm, PRIBIO, "aacwait", timeout);
+               error = tsleep_nsec(cm, PRIBIO, "aacwait", MSEC_TO_NSEC(msecs));
                AAC_LOCK_ACQUIRE(&sc->aac_io_lock);
        }
        return (error);

Reply via email to