- 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
This commit is contained in:
Maxime Henrion 2003-04-11 12:52:52 +00:00
parent a4c9ca4f83
commit 20f0c80f6f

View File

@ -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);
}