diff options
author | emax <emax@FreeBSD.org> | 2005-07-27 21:03:35 +0000 |
---|---|---|
committer | emax <emax@FreeBSD.org> | 2005-07-27 21:03:35 +0000 |
commit | 8bbe23871b53de4a48c324d7d0221e45f50e7ef0 (patch) | |
tree | 50f9ed8b6db8651b4cd72ca149931dbd1204fde3 /sys/dev | |
parent | b8779c810b9f3babd08da008e9fc252ab822d00c (diff) | |
download | FreeBSD-src-8bbe23871b53de4a48c324d7d0221e45f50e7ef0.zip FreeBSD-src-8bbe23871b53de4a48c324d7d0221e45f50e7ef0.tar.gz |
Reorganize an_detach() a bit. Make sure ether_ifdetach() and if_free()
are called outside of AN_LOCK()/AN_UNLOCK. This fixes the following
WITNESS warning (produced when an(4) PCMCIA card is detached).
taskqueue_drain with the following non-sleepable locks held:
exclusive sleep mutex an0 (network driver) r = 0 (0xc59af168) locked @ /usr/src/sys/dev/an/if_an.c:2836
MFC after: 3 days
Silence from: current@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/an/if_an.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/an/if_an.c b/sys/dev/an/if_an.c index 1722471..eade4e1 100644 --- a/sys/dev/an/if_an.c +++ b/sys/dev/an/if_an.c @@ -826,18 +826,19 @@ an_detach(device_t dev) struct an_softc *sc = device_get_softc(dev); struct ifnet *ifp = sc->an_ifp; + AN_LOCK(sc); if (sc->an_gone) { + AN_UNLOCK(sc); device_printf(dev,"already unloaded\n"); return(0); } - AN_LOCK(sc); an_stop(sc); + sc->an_gone = 1; ifmedia_removeall(&sc->an_ifmedia); ifp->if_flags &= ~IFF_RUNNING; + AN_UNLOCK(sc); ether_ifdetach(ifp); if_free(ifp); - sc->an_gone = 1; - AN_UNLOCK(sc); bus_teardown_intr(dev, sc->irq_res, sc->irq_handle); an_release_resources(dev); mtx_destroy(&sc->an_mtx); |