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 No need to hold two locks.
details: https://anonhg.NetBSD.org/src-all/rev/7333b93fbfb6
branches: trunk
changeset: 371152:7333b93fbfb6
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Fri Aug 05 23:32:36 2022 +1000
description:
No need to hold two locks.
diffstat:
sys/dev/usb/if_urtwn.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diffs (58 lines):
diff -r d4bf09edd8e2 -r 7333b93fbfb6 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Fri Aug 05 23:30:49 2022 +1000
+++ b/sys/dev/usb/if_urtwn.c Fri Aug 05 23:32:36 2022 +1000
@@ -674,7 +674,6 @@
struct ieee80211vap *vap;
struct urtwn_host_cmd_ring *ring = &sc->cmdq;
struct urtwn_host_cmd *cmd;
- int s;
URTWNHIST_FUNC(); URTWNHIST_CALLED();
@@ -700,22 +699,18 @@
usbwifi_unlock_ic(&sc->sc_uw);
/* Process host commands. */
- s = splusb();
mutex_spin_enter(&sc->sc_task_mtx);
while (ring->next != ring->cur) {
cmd = &ring->cmd[ring->next];
+ ring->queued--;
+ ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
mutex_spin_exit(&sc->sc_task_mtx);
- splx(s);
/* Invoke callback with kernel lock held. */
cmd->cb(sc, cmd->data);
- s = splusb();
mutex_spin_enter(&sc->sc_task_mtx);
- ring->queued--;
- ring->next = (ring->next + 1) % URTWN_HOST_CMD_RING_COUNT;
}
cv_broadcast(&sc->sc_task_cv);
mutex_spin_exit(&sc->sc_task_mtx);
- splx(s);
}
static void
@@ -725,13 +720,11 @@
{
struct urtwn_host_cmd_ring *ring = &sc->cmdq;
struct urtwn_host_cmd *cmd;
- int s;
URTWNHIST_FUNC(); URTWNHIST_CALLED();
DPRINTFN(DBG_FN, "cb=%jd, arg=%jd, len=%jd", (intptr_t)cb,
(intptr_t)arg, len, 0);
- s = splusb();
mutex_spin_enter(&sc->sc_task_mtx);
cmd = &ring->cmd[ring->cur];
cmd->cb = cb;
@@ -745,7 +738,6 @@
usb_add_task(sc->sc_uw.uw_udev, &sc->sc_task, USB_TASKQ_DRIVER);
} else
mutex_spin_exit(&sc->sc_task_mtx);
- splx(s);
}
__unused static void
Home |
Main Index |
Thread Index |
Old Index