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/38f1d947b7c8
branches:  trunk
changeset: 377716:38f1d947b7c8
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 55d354f8f2b1 -r 38f1d947b7c8 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
@@ -3019,6 +3019,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
        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)
@@ -3026,6 +3027,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
                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);
@@ -3090,6 +3092,7 @@ urtwn_rxeof(struct usbd_xfer *xfer, void
            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