Source-Changes-HG archive

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

[src-draft/trunk]: src/sys/dev/usb Serialize usb reads and writes. Another a...



details:   https://anonhg.NetBSD.org/src-all/rev/661189df63af
branches:  trunk
changeset: 939542:661189df63af
user:      Nathanial Sloss <nat%netbsd.org@localhost>
date:      Mon Jun 08 05:49:03 2020 +1000

description:
Serialize usb reads and writes.  Another attempt at solving usb issues
with urtwn.

diffstat:

 sys/dev/usb/if_urtwn.c |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 4eedc70f3b8f -r 661189df63af sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c    Mon Jun 08 05:48:10 2020 +1000
+++ b/sys/dev/usb/if_urtwn.c    Mon Jun 08 05:49:03 2020 +1000
@@ -3013,6 +3013,7 @@
        DPRINTFN(DBG_FN|DBG_RX, ("%s: %s: status=%d\n",
            device_xname(sc->sc_dev), __func__, status));
 
+       mutex_enter(&sc->sc_write_mtx);
        mutex_enter(&sc->sc_rx_mtx);
        if (__predict_false(status != USBD_NORMAL_COMPLETION)) {
                if (status == USBD_STALLED)
@@ -3020,6 +3021,7 @@
                else if (status != USBD_CANCELLED)
                        goto resubmit;
                mutex_exit(&sc->sc_rx_mtx);
+               mutex_exit(&sc->sc_write_mtx);
                return;
        }
        usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL);
@@ -3084,6 +3086,7 @@
            USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT, urtwn_rxeof);
        (void)usbd_transfer(xfer);
        mutex_exit(&sc->sc_rx_mtx);
+       mutex_exit(&sc->sc_write_mtx);
 }
 
 static void



Home | Main Index | Thread Index | Old Index