diff options
author | 2009-10-31 11:52:07 +0000 | |
---|---|---|
committer | 2009-10-31 11:52:07 +0000 | |
commit | 6996b25ba3ec5574d3725975c566e48c2aee60aa (patch) | |
tree | 9252479bb37afcf2354b31f466eb7cd33121ea9d | |
parent | tweak the description for iop(4) again, this one was the diff (diff) | |
download | wireguard-openbsd-6996b25ba3ec5574d3725975c566e48c2aee60aa.tar.xz wireguard-openbsd-6996b25ba3ec5574d3725975c566e48c2aee60aa.zip |
reorder operations in detach(), call powerhook_disestablish() earlier,
call if_detach() last.
no need to splnet() since we are already called at the right ipl.
iwn(4) diff from deraadt@
-rw-r--r-- | sys/dev/pci/if_iwn.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/if_wpi.c | 18 |
2 files changed, 16 insertions, 20 deletions
diff --git a/sys/dev/pci/if_iwn.c b/sys/dev/pci/if_iwn.c index befdf873342..2a4b52c882c 100644 --- a/sys/dev/pci/if_iwn.c +++ b/sys/dev/pci/if_iwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwn.c,v 1.72 2009/10/28 18:42:47 damien Exp $ */ +/* $OpenBSD: if_iwn.c,v 1.73 2009/10/31 11:52:07 damien Exp $ */ /*- * Copyright (c) 2007-2009 Damien Bergamini <damien.bergamini@free.fr> @@ -667,18 +667,16 @@ iwn_detach(struct device *self, int flags) { struct iwn_softc *sc = (struct iwn_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; - int s, qid; + int qid; - s = splnet(); timeout_del(&sc->calib_to); /* Uninstall interrupt handler. */ if (sc->sc_ih != NULL) pci_intr_disestablish(sc->sc_pct, sc->sc_ih); - ieee80211_ifdetach(ifp); - if_detach(ifp); - splx(s); + if (sc->powerhook != NULL) + powerhook_disestablish(sc->powerhook); /* Free DMA resources. */ iwn_free_rx_ring(sc, &sc->rxq); @@ -690,16 +688,16 @@ iwn_detach(struct device *self, int flags) iwn_free_ict(sc); iwn_free_fwmem(sc); + bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz); + #ifndef SMALL_KERNEL /* Detach the thermal sensor. */ sensor_detach(&sc->sensordev, &sc->sensor); sensordev_deinstall(&sc->sensordev); #endif - if (sc->powerhook != NULL) - powerhook_disestablish(sc->powerhook); - - bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz); + ieee80211_ifdetach(ifp); + if_detach(ifp); return 0; } diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index c2113136f25..86463d786e9 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.96 2009/10/26 18:38:32 damien Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.97 2009/10/31 11:52:07 damien Exp $ */ /*- * Copyright (c) 2006-2008 @@ -388,18 +388,16 @@ wpi_detach(struct device *self, int flags) { struct wpi_softc *sc = (struct wpi_softc *)self; struct ifnet *ifp = &sc->sc_ic.ic_if; - int s, qid; + int qid; - s = splnet(); timeout_del(&sc->calib_to); /* Uninstall interrupt handler. */ if (sc->sc_ih != NULL) pci_intr_disestablish(sc->sc_pct, sc->sc_ih); - ieee80211_ifdetach(ifp); - if_detach(ifp); - splx(s); + if (sc->powerhook != NULL) + powerhook_disestablish(sc->powerhook); /* Free DMA resources. */ wpi_free_rx_ring(sc, &sc->rxq); @@ -408,16 +406,16 @@ wpi_detach(struct device *self, int flags) wpi_free_shared(sc); wpi_free_fwmem(sc); + bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz); + #ifndef SMALL_KERNEL /* Detach the thermal sensor. */ sensor_detach(&sc->sensordev, &sc->sensor); sensordev_deinstall(&sc->sensordev); #endif - if (sc->powerhook != NULL) - powerhook_disestablish(sc->powerhook); - - bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_sz); + ieee80211_ifdetach(ifp); + if_detach(ifp); return 0; } |