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 Revert 1034573:03670dfebb8c



details:   https://anonhg.NetBSD.org/src-all/rev/a9acf4f891cb
branches:  trunk
changeset: 374488:a9acf4f891cb
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Thu Apr 27 22:21:06 2023 +1000

description:
Revert 1034573:03670dfebb8c

The logic used is incorrect and will be corrected in the next commit.

diffstat:

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

diffs (66 lines):

diff -r 37acba832d30 -r a9acf4f891cb sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c      Thu Apr 27 22:17:50 2023 +1000
+++ b/sys/dev/pci/if_iwn.c      Thu Apr 27 22:21:06 2023 +1000
@@ -3883,13 +3883,7 @@ 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);
 
-       if (async)
-               return 0;
-
-       if ((error = kpause("iwncmd", false, hz, NULL)) != EWOULDBLOCK)
-               return error;
-
-       return 0;
+       return async ? 0 : tsleep(desc, PCATCH, "iwncmd", hz);
 }
 
 static int
@@ -5804,12 +5798,8 @@ 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 = kpause("iwncal", false, 2 * hz, NULL);
-               if (error == EWOULDBLOCK)
-                       error = 0;
-       }
-
+       if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE))
+               error = tsleep(sc, PCATCH, "iwncal", 2 * hz);
        return error;
 }
 
@@ -6140,8 +6130,7 @@ iwn4965_load_firmware(struct iwn_softc *
        IWN_WRITE(sc, IWN_RESET, 0);
 
        /* Wait at most one second for first alive notification. */
-       if ((error = kpause("iwninit", false, hz, NULL)) != 0 &&
-           error != EWOULDBLOCK) {
+       if ((error = tsleep(sc, PCATCH, "iwninit", hz)) != 0) {
                aprint_error_dev(sc->sc_dev,
                    "timeout waiting for adapter to initialize\n");
                return error;
@@ -6208,11 +6197,7 @@ iwn5000_load_firmware_section(struct iwn
        iwn_nic_unlock(sc);
 
        /* Wait at most five seconds for FH DMA transfer to complete. */
-       
-       error = kpause("iwninit", false, 5 * hz, NULL);
-       if (error != EWOULDBLOCK)
-               return error;
-       return 0;
+       return tsleep(sc, PCATCH, "iwninit", 5 * hz);
 }
 
 static int
@@ -6801,8 +6786,7 @@ iwn_hw_init(struct iwn_softc *sc)
                return error;
        }
        /* Wait at most one second for firmware alive notification. */
-       if ((error = kpause("iwninit", false, hz, NULL)) != 0 &&
-           error != EWOULDBLOCK) {
+       if ((error = tsleep(sc, PCATCH, "iwninit", hz)) != 0) {
                aprint_error_dev(sc->sc_dev,
                    "timeout waiting for adapter to initialize\n");
                return error;



Home | Main Index | Thread Index | Old Index