diff options
author | mux <mux@FreeBSD.org> | 2003-04-11 12:52:52 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2003-04-11 12:52:52 +0000 |
commit | b64a74ff56809789ac6c8d4b76792b6110e3bbfd (patch) | |
tree | 567a70c815abcba3c2be5402cf98357100f4993f /sys | |
parent | ae179e006f3631f2c4268b0b04501fde5a2771fc (diff) | |
download | FreeBSD-src-b64a74ff56809789ac6c8d4b76792b6110e3bbfd.zip FreeBSD-src-b64a74ff56809789ac6c8d4b76792b6110e3bbfd.tar.gz |
- Call ether_ifdetach() before shutting down the hardware.
- Remove a useless device_is_alive() check.
- Disable interrupts if bus_child_present() so that this
check is more useful.
This fixes the hangs I was seeing when unloading the fxp driver.
Suggestions from: hsu, njl
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/fxp/if_fxp.c | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c index 2612fd8..bf9d18f 100644 --- a/sys/dev/fxp/if_fxp.c +++ b/sys/dev/fxp/if_fxp.c @@ -869,34 +869,32 @@ fxp_detach(device_t dev) struct fxp_softc *sc = device_get_softc(dev); int s; - /* disable interrupts */ - CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); - s = splimp(); + /* + * Close down routes etc. + */ + ether_ifdetach(&sc->arpcom.ac_if); - if (device_is_alive(dev)) { - /* - * Stop DMA and drop transmit queue. - */ - if (bus_child_present(dev)) - fxp_stop(sc); - /* - * Close down routes etc. - */ - ether_ifdetach(&sc->arpcom.ac_if); - device_delete_child(dev, sc->miibus); - bus_generic_detach(dev); - /* - * Free all media structures. - */ - ifmedia_removeall(&sc->sc_media); + /* + * Stop DMA and drop transmit queue. + */ + if (bus_child_present(dev)) { + /* disable interrupts */ + CSR_WRITE_1(sc, FXP_CSR_SCB_INTRCNTL, FXP_SCB_INTR_DISABLE); + fxp_stop(sc); } + device_delete_child(dev, sc->miibus); + bus_generic_detach(dev); + /* + * Free all media structures. + */ + ifmedia_removeall(&sc->sc_media); + splx(s); /* Release our allocated resources. */ fxp_release(sc); - return (0); } |