Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/pci Fix locking.
details: https://anonhg.NetBSD.org/src-all/rev/ec920f0a8de1
branches: trunk
changeset: 377150:ec920f0a8de1
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Fri Apr 28 01:16:05 2023 +1000
description:
Fix locking.
diffstat:
sys/dev/pci/if_iwn.c | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diffs (90 lines):
diff -r 897c5cc3ffdc -r ec920f0a8de1 sys/dev/pci/if_iwn.c
--- a/sys/dev/pci/if_iwn.c Thu Apr 27 23:44:42 2023 +1000
+++ b/sys/dev/pci/if_iwn.c Fri Apr 28 01:16:05 2023 +1000
@@ -926,7 +926,9 @@ printf("SET_CHANNEL\n");
* are already taken care of by their respective firmware commands.
*/
if (ic->ic_opmode == IEEE80211_M_MONITOR) {
+ mutex_enter(&sc->sc_mtx);
error = iwn_config(vap);
+ mutex_exit(&sc->sc_mtx);
if (error != 0)
device_printf(sc->sc_dev,
"%s: error %d settting channel\n", __func__, error);
@@ -2373,9 +2375,11 @@ iwn_calib_timeout(void *arg)
if (++sc->calib_cnt >= 120) {
uint32_t flags = 0;
+ mutex_enter(&sc->sc_mtx);
DPRINTF(("sending request for statistics\n"));
(void)iwn_cmd(sc, IWN_CMD_GET_STATISTICS, &flags,
sizeof flags, 1);
+ mutex_exit(&sc->sc_mtx);
sc->calib_cnt = 0;
}
splx(s);
@@ -3899,9 +3903,7 @@ iwn_cmd(struct iwn_softc *sc, int code,
if (async)
return 0;
- mutex_enter(&sc->sc_mtx);
error = cv_timedwait_sig(&sc->t_event, &sc->sc_mtx, hz);
- mutex_exit(&sc->sc_mtx);
return error;
}
@@ -5818,11 +5820,9 @@ iwn5000_query_calibration(struct iwn_sof
return error;
/* Wait at most two seconds for calibration to complete. */
- if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE)) {
- mutex_enter(&sc->sc_mtx);
+ if (!(sc->sc_flags & IWN_FLAG_CALIB_DONE))
error = cv_timedwait_sig(&sc->t_event, &sc->sc_mtx, hz * 2);
- mutex_exit(&sc->sc_mtx);
- }
+
return error;
}
@@ -6153,14 +6153,11 @@ iwn4965_load_firmware(struct iwn_softc *
IWN_WRITE(sc, IWN_RESET, 0);
/* Wait at most one second for first alive notification. */
- mutex_enter(&sc->sc_mtx);
if ((error = cv_timedwait_sig(&sc->t_event, &sc->sc_mtx, hz)) != 0) {
- mutex_exit(&sc->sc_mtx);
aprint_error_dev(sc->sc_dev,
"timeout waiting for adapter to initialize\n");
return error;
}
- mutex_exit(&sc->sc_mtx);
/* Retrieve current temperature for initial TX power calibration. */
sc->rawtemp = sc->ucode_info.temp[3].chan20MHz;
@@ -6223,9 +6220,7 @@ iwn5000_load_firmware_section(struct iwn
iwn_nic_unlock(sc);
/* Wait at most five seconds for FH DMA transfer to complete. */
- mutex_enter(&sc->sc_mtx);
error = cv_timedwait_sig(&sc->t_event, &sc->sc_mtx, hz * 5);
- mutex_exit(&sc->sc_mtx);
return error;
}
@@ -6815,15 +6810,12 @@ iwn_hw_init(struct iwn_softc *sc)
"could not load firmware\n");
return error;
}
- mutex_enter(&sc->sc_mtx);
/* Wait at most one second for firmware alive notification. */
if ((error = cv_timedwait_sig(&sc->t_event, &sc->sc_mtx, hz)) != 0) {
- mutex_exit(&sc->sc_mtx);
aprint_error_dev(sc->sc_dev,
"timeout waiting for adapter to initialize\n");
return error;
}
- mutex_exit(&sc->sc_mtx);
/* Do post-firmware initialization. */
return ops->post_alive(sc);
Home |
Main Index |
Thread Index |
Old Index