From bf853d22ab237835e70cfe9aa7bb2fdfa5539a17 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Sun, 3 Jul 2005 16:47:20 +0000 Subject: [PATCH] Slightly chance the order of interrupt handling. First hook the interrupt up last and keep the critical section in detach. This is a prequirement for the elimination of wi_gone. --- sys/dev/netif/wi/if_wi.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sys/dev/netif/wi/if_wi.c b/sys/dev/netif/wi/if_wi.c index 5b6823a10c..afe933129a 100644 --- a/sys/dev/netif/wi/if_wi.c +++ b/sys/dev/netif/wi/if_wi.c @@ -32,7 +32,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/wi/if_wi.c,v 1.166 2004/04/01 00:38:45 sam Exp $ - * $DragonFly: src/sys/dev/netif/wi/if_wi.c,v 1.28 2005/06/30 17:11:28 joerg Exp $ + * $DragonFly: src/sys/dev/netif/wi/if_wi.c,v 1.29 2005/07/03 16:47:20 joerg Exp $ */ /* @@ -249,17 +249,6 @@ wi_attach(device_t dev) ifp->if_softc = sc; if_initname(ifp, device_get_name(dev), device_get_unit(dev)); - /* - * NB: no locking is needed here; don't put it here - * unless you can prove it! - */ - error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, - wi_intr, sc, &sc->wi_intrhand, NULL); - if (error) { - device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); - goto fail; - } - sc->wi_cmd_count = 500; /* Reset the NIC. */ error = wi_reset(sc); @@ -492,6 +481,14 @@ wi_attach(device_t dev) sc->sc_rx_th.wr_ihdr.it_present = htole32(WI_RX_RADIOTAP_PRESENT); + error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, + wi_intr, sc, &sc->wi_intrhand, NULL); + if (error) { + ieee80211_ifdetach(ifp); + device_printf(dev, "bus_setup_intr() failed! (%d)\n", error); + goto fail; + } + return(0); fail: @@ -514,8 +511,8 @@ wi_detach(device_t dev) wi_stop(ifp, 0); ieee80211_ifdetach(ifp); - WI_UNLOCK(sc); wi_free(dev); + WI_UNLOCK(sc); return (0); } -- 2.41.0