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 Wrap up abort pipe and rxeof in rx/tx mute...
details: https://anonhg.NetBSD.org/src-all/rev/c8f2fb27a35d
branches: trunk
changeset: 940792:c8f2fb27a35d
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Sun May 03 19:16:20 2020 +1000
description:
Wrap up abort pipe and rxeof in rx/tx mutexes.
diffstat:
sys/dev/usb/if_urtwn.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diffs (48 lines):
diff -r a7fddf301d20 -r c8f2fb27a35d sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Sun May 03 12:39:32 2020 +1000
+++ b/sys/dev/usb/if_urtwn.c Sun May 03 19:16:20 2020 +1000
@@ -2968,11 +2968,13 @@
DPRINTFN(DBG_FN|DBG_RX, ("%s: %s: status=%d\n",
device_xname(sc->sc_dev), __func__, status));
+ mutex_enter(&sc->sc_rx_mtx);
if (__predict_false(status != USBD_NORMAL_COMPLETION)) {
if (status == USBD_STALLED)
usbd_clear_endpoint_stall_async(sc->rx_pipe[pidx]);
else if (status != USBD_CANCELLED)
goto resubmit;
+ mutex_exit(&sc->sc_rx_mtx);
return;
}
usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL);
@@ -3036,6 +3038,7 @@
usbd_setup_xfer(xfer, data, data->buf, URTWN_RXBUFSZ,
USBD_SHORT_XFER_OK, USBD_NO_TIMEOUT, urtwn_rxeof);
(void)usbd_transfer(xfer);
+ mutex_exit(&sc->sc_rx_mtx);
}
static void
@@ -5780,17 +5783,21 @@
callout_stop(&sc->sc_scan_to);
callout_stop(&sc->sc_calib_to);
+ mutex_enter(&sc->sc_tx_mtx);
/* Abort Tx. */
for (i = 0; i < sc->tx_npipe; i++) {
if (sc->tx_pipe[i] != NULL)
usbd_abort_pipe(sc->tx_pipe[i]);
}
-
+ mutex_exit(&sc->sc_tx_mtx);
+
+ mutex_enter(&sc->sc_rx_mtx);
/* Stop Rx pipe. */
for (i = 0; i < sc->rx_npipe; i++) {
if (sc->rx_pipe[i] != NULL)
usbd_abort_pipe(sc->rx_pipe[i]);
}
+ mutex_exit(&sc->sc_rx_mtx);
sc->sc_running = false;
if (disable)
Home |
Main Index |
Thread Index |
Old Index