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/4d16664ad7a9
branches:  trunk
changeset: 986446:4d16664ad7a9
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 fb28b475c3c6 -r 4d16664ad7a9 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
@@ -3017,6 +3017,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)
@@ -3024,6 +3025,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);
@@ -3088,6 +3090,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