Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/dev/pci tsleep(9) is depreciated. Use kpause(9) i...



details:   https://anonhg.NetBSD.org/src-all/rev/a8a76103c471
branches:  trunk
changeset: 377032:a8a76103c471
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Sat Nov 20 01:57:01 2021 +1100

description:
tsleep(9) is depreciated.  Use kpause(9) instead.

diffstat:

 sys/dev/pci/if_iwn.c |  28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diffs (66 lines):

diff -r af997acc28f0 -r a8a76103c471 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Sat Nov 20 01:54:23 2021 +1100
+++ b/sys/dev/pci/if_iwn.c      Sat Nov 20 01:57:01 2021 +1100
@@ -3903,7 +3903,13 @@ iwn_cmd(struct iwn_softc *sc, int code, 
        ring->cur = (ring->cur + 1) % IWN_TX_RING_COUNT;
        IWN_WRITE(sc, IWN_HBUS_TARG_WRPTR, ring->qid << 8 | ring->cur);
 
-       return async ? 0 : tsleep(desc, PCATCH, "iwncmd", hz);
+       if (async)
+               return 0;
+
+       if ((error = kpause("iwncmd", false, hz, NULL)) != EWOULDBLOCK)
+               return error;
+
+       return 0;
 }
 
 static int
@@ -5818,8 +5824,12 @@ iwn5000_query_calibration(struct iwn_sof
                return error;
 
        /* Wait at most two seconds for calibration to complete. */
-       if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE))
-               error = tsleep(sc, PCATCH, "iwncal", 2 * hz);
+       if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE)) {
+               error = kpause("iwncal", false, 2 * hz, NULL);
+               if (error == EWOULDBLOCK)
+                       error = 0;
+       }
+
        return error;
 }
 
@@ -6150,7 +6160,8 @@ iwn4965_load_firmware(struct iwn_softc *
        IWN_WRITE(sc, IWN_RESET, 0);
 
        /* Wait at most one second for first alive notification. */
-       if ((error = tsleep(sc, PCATCH, "iwninit", hz)) != 0) {
+       if ((error = kpause("iwninit", false, hz, NULL)) != 0 &&
+           error != EWOULDBLOCK) {
                aprint_error_dev(sc->sc_dev,
                    "timeout waiting for adapter to initialize\n");
                return error;
@@ -6217,7 +6228,11 @@ iwn5000_load_firmware_section(struct iwn
        iwn_nic_unlock(sc);
 
        /* Wait at most five seconds for FH DMA transfer to complete. */
-       return tsleep(sc, PCATCH, "iwninit", 5 * hz);
+       
+       error = kpause("iwninit", false, 5 * hz, NULL);
+       if (error != EWOULDBLOCK)
+               return error;
+       return 0;
 }
 
 static int
@@ -6806,7 +6821,8 @@ iwn_hw_init(struct iwn_softc *sc)
                return error;
        }
        /* Wait at most one second for firmware alive notification. */
-       if ((error = tsleep(sc, PCATCH, "iwninit", hz)) != 0) {
+       if ((error = kpause("iwninit", false, hz, NULL)) != 0 &&
+           error != EWOULDBLOCK) {
                aprint_error_dev(sc->sc_dev,
                    "timeout waiting for adapter to initialize\n");
                return error;



Home | Main Index | Thread Index | Old Index