This pattern is starting to look very familiar :)

Convert the TIMEOUT constants from ticks to seconds, change the unit
for imxesdhc_wait_intr() from ticks to seconds, then change tsleep(9)
to tsleep_nsec(9).

ok?

Index: fdt/imxesdhc.c
===================================================================
RCS file: /cvs/src/sys/dev/fdt/imxesdhc.c,v
retrieving revision 1.11
diff -u -p -r1.11 imxesdhc.c
--- fdt/imxesdhc.c      29 Dec 2018 11:37:54 -0000      1.11
+++ fdt/imxesdhc.c      11 Jan 2020 01:01:41 -0000
@@ -148,10 +148,11 @@
 #define SDHC_WTMK_LVL_WR_WML_SHIFT             16
 #define SDHC_WTMK_LVL_WR_BRST_LEN_SHIFT                24
 
-#define SDHC_COMMAND_TIMEOUT                   hz
-#define SDHC_BUFFER_TIMEOUT                    hz
-#define SDHC_TRANSFER_TIMEOUT                  hz
-#define SDHC_DMA_TIMEOUT                       (3 * hz)
+/* Timeouts in seconds. */
+#define SDHC_COMMAND_TIMEOUT                   1
+#define SDHC_BUFFER_TIMEOUT                    1
+#define SDHC_TRANSFER_TIMEOUT                  1
+#define SDHC_DMA_TIMEOUT                       3
 
 #define SDHC_ADMA2_VALID                       (1 << 0)
 #define SDHC_ADMA2_END                         (1 << 1)
@@ -1137,7 +1138,7 @@ imxesdhc_soft_reset(struct imxesdhc_soft
 }
 
 int
-imxesdhc_wait_intr(struct imxesdhc_softc *sc, int mask, int timo)
+imxesdhc_wait_intr(struct imxesdhc_softc *sc, int mask, int secs)
 {
        int status;
        int s;
@@ -1152,8 +1153,8 @@ imxesdhc_wait_intr(struct imxesdhc_softc
 
        status = sc->intr_status & mask;
        while (status == 0) {
-               if (tsleep(&sc->intr_status, PWAIT, "hcintr", timo)
-                   == EWOULDBLOCK) {
+               if (tsleep_nsec(&sc->intr_status, PWAIT, "hcintr",
+                   SEC_TO_NSEC(secs)) == EWOULDBLOCK) {
                        status |= SDHC_INT_STATUS_ERR;
                        break;
                }

Reply via email to