PERFORCE change 136160 for review
Sepherosa Ziehau
sephe at FreeBSD.org
Mon Feb 25 11:56:47 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=136160
Change 136160 by sephe at sephe_zealot:sam_wifi on 2008/02/25 11:56:15
Silent witness warning about sleeping with non-sleepable lock
(recursive driver lock) held
Affected files ...
.. //depot/projects/wifi/sys/dev/bwi/bwimac.c#9 edit
.. //depot/projects/wifi/sys/dev/bwi/if_bwi.c#24 edit
Differences ...
==== //depot/projects/wifi/sys/dev/bwi/bwimac.c#9 (text+ko) ====
@@ -882,6 +882,8 @@
char fwname[64];
int idx;
+ BWI_ASSERT_LOCKED(sc);
+
/*
* Try getting the firmware stub so firmware
* module would be loaded automatically
@@ -889,7 +891,9 @@
if (mac->mac_stub == NULL) {
snprintf(fwname, sizeof(fwname), BWI_FW_STUB_PATH,
sc->sc_fw_version);
+ BWI_UNLOCK(sc);
mac->mac_stub = firmware_get(fwname);
+ BWI_LOCK(sc);
if (mac->mac_stub == NULL) {
if_printf(ifp, "request firmware %s failed\n", fwname);
return ENOMEM;
@@ -901,7 +905,9 @@
sc->sc_fw_version,
mac->mac_rev >= 5 ? 5 : mac->mac_rev);
+ BWI_UNLOCK(sc);
mac->mac_ucode = firmware_get(fwname);
+ BWI_LOCK(sc);
if (mac->mac_ucode == NULL) {
if_printf(ifp, "request firmware %s failed\n", fwname);
return ENOMEM;
@@ -916,7 +922,9 @@
sc->sc_fw_version,
mac->mac_rev < 5 ? 4 : 5);
+ BWI_UNLOCK(sc);
mac->mac_pcm = firmware_get(fwname);
+ BWI_LOCK(sc);
if (mac->mac_pcm == NULL) {
if_printf(ifp, "request firmware %s failed\n", fwname);
return ENOMEM;
@@ -941,7 +949,9 @@
snprintf(fwname, sizeof(fwname), BWI_FW_IV_PATH,
sc->sc_fw_version, idx);
+ BWI_UNLOCK(sc);
mac->mac_iv = firmware_get(fwname);
+ BWI_LOCK(sc);
if (mac->mac_iv == NULL) {
if_printf(ifp, "request firmware %s failed\n", fwname);
return ENOMEM;
@@ -967,7 +977,9 @@
snprintf(fwname, sizeof(fwname), BWI_FW_IV_EXT_PATH,
sc->sc_fw_version, idx);
+ BWI_UNLOCK(sc);
mac->mac_iv_ext = firmware_get(fwname);
+ BWI_LOCK(sc);
if (mac->mac_iv_ext == NULL) {
if_printf(ifp, "request firmware %s failed\n", fwname);
return ENOMEM;
==== //depot/projects/wifi/sys/dev/bwi/if_bwi.c#24 (text+ko) ====
@@ -94,6 +94,7 @@
} __packed;
static void bwi_init(void *);
+static void bwi_init_locked(struct bwi_softc *);
static int bwi_ioctl(struct ifnet *, u_long, caddr_t);
static void bwi_start(struct ifnet *);
static void bwi_start_locked(struct ifnet *);
@@ -1186,7 +1187,18 @@
static void
bwi_init(void *xsc)
{
- bwi_init_statechg(xsc, 1);
+ struct bwi_softc *sc = xsc;
+
+ BWI_LOCK(sc);
+ bwi_init_locked(sc);
+ BWI_UNLOCK(sc);
+}
+
+static void
+bwi_init_locked(struct bwi_softc *sc)
+{
+ BWI_ASSERT_LOCKED(sc);
+ bwi_init_statechg(sc, 1);
}
static void
@@ -1197,7 +1209,7 @@
struct bwi_mac *mac;
int error;
- BWI_LOCK(sc);
+ BWI_ASSERT_LOCKED(sc);
bwi_stop(sc, statechg);
@@ -1276,7 +1288,6 @@
bwi_stop(sc, 1);
else
bwi_start_locked(ifp);
- BWI_UNLOCK(sc);
}
static int
@@ -1316,7 +1327,7 @@
if (ifp->if_flags & IFF_UP) {
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
- bwi_init(sc);
+ bwi_init_locked(sc);
} else {
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
bwi_stop(sc, 1);
@@ -1329,7 +1340,7 @@
if (error == ENETRESET) {
if (IS_RUNNING(ifp))
- bwi_init(sc);
+ bwi_init_locked(sc);
error = 0;
}
BWI_UNLOCK(sc);
@@ -1866,7 +1877,7 @@
BWI_LOCK(sc);
if (ieee80211_media_change(ifp) == ENETRESET && IS_RUNNING(ifp))
- bwi_init(ifp->if_softc);
+ bwi_init_locked(ifp->if_softc);
BWI_UNLOCK(sc);
return 0;
@@ -4324,6 +4335,8 @@
{
struct bwi_softc *sc = xsc;
+ BWI_LOCK(sc);
if_printf(sc->sc_ifp, "%s begin\n", __func__);
bwi_init_statechg(xsc, 0);
+ BWI_UNLOCK(sc);
}
More information about the p4-projects
mailing list