Better use of gone.

This commit is contained in:
imp 2005-09-20 19:50:27 +00:00
parent c1ba22dc8d
commit 70a9967120

View File

@ -350,19 +350,17 @@ ep_detach(device_t dev)
struct ifnet *ifp; struct ifnet *ifp;
sc = device_get_softc(dev); sc = device_get_softc(dev);
EP_ASSERT_UNLOCKED(sc);
ifp = sc->ifp; ifp = sc->ifp;
EP_ASSERT_UNLOCKED(sc);
if (sc->gone) EP_LOCK(sc);
return (0);
if (bus_child_present(dev)) if (bus_child_present(dev))
epstop(sc); epstop(sc);
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
ether_ifdetach(ifp);
sc->gone = 1; sc->gone = 1;
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
EP_UNLOCK(sc);
ether_ifdetach(ifp);
ep_free(dev); ep_free(dev);
if_free(ifp); if_free(ifp);
EP_LOCK_DESTROY(sc); EP_LOCK_DESTROY(sc);
@ -964,8 +962,6 @@ epwatchdog(struct ifnet *ifp)
static void static void
epstop(struct ep_softc *sc) epstop(struct ep_softc *sc)
{ {
if (sc->gone)
return;
CSR_WRITE_2(sc, EP_COMMAND, RX_DISABLE); CSR_WRITE_2(sc, EP_COMMAND, RX_DISABLE);
CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK); CSR_WRITE_2(sc, EP_COMMAND, RX_DISCARD_TOP_PACK);
EP_BUSY_WAIT(sc); EP_BUSY_WAIT(sc);