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/65e4160ba91e
branches:  trunk
changeset: 360846:65e4160ba91e
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 601997bcd542 -r 65e4160ba91e 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
@@ -3018,6 +3018,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)
@@ -3025,6 +3026,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);
@@ -3089,6 +3091,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