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/1257f2240d43
branches:  trunk
changeset: 1026323:1257f2240d43
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 9b2e0615afc6 -r 1257f2240d43 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 @@
        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 @@
                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 @@
        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 @@
        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 @@
                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