diff options
author | jhb <jhb@FreeBSD.org> | 2009-11-19 22:04:02 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2009-11-19 22:04:02 +0000 |
commit | 5a87f586d4c2512fa5b89d4d4258e0471939a4b3 (patch) | |
tree | dc2626b9b9f9dc907cb3603d02a8e37472643719 /sys/arm | |
parent | 34e178ad01462dcf389d38153c0803183fe352f7 (diff) | |
download | FreeBSD-src-5a87f586d4c2512fa5b89d4d4258e0471939a4b3.zip FreeBSD-src-5a87f586d4c2512fa5b89d4d4258e0471939a4b3.tar.gz |
- Initialize callout before it is used in atestop() during attach.
- Reorder detach so that ether_ifdetach() is called first. This removes
the race that ATE_FLAG_DETACHING closed, so that flag can be removed.
- Trim a duplicate clearing of IFF_DRV_RUNNING.
Reviewed by: imp
Diffstat (limited to 'sys/arm')
-rw-r--r-- | sys/arm/at91/if_ate.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/arm/at91/if_ate.c b/sys/arm/at91/if_ate.c index bde7fb9..6412515 100644 --- a/sys/arm/at91/if_ate.c +++ b/sys/arm/at91/if_ate.c @@ -75,8 +75,7 @@ __FBSDID("$FreeBSD$"); /* * Driver-specific flags. */ -#define ATE_FLAG_DETACHING 0x01 -#define ATE_FLAG_MULTICAST 0x02 +#define ATE_FLAG_MULTICAST 0x01 struct ate_softc { @@ -196,6 +195,7 @@ ate_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; ATE_LOCK_INIT(sc); + callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0); /* * Allocate resources. @@ -233,7 +233,6 @@ ate_attach(device_t dev) ATE_LOCK(sc); atestop(sc); ATE_UNLOCK(sc); - callout_init_mtx(&sc->tick_ch, &sc->sc_mtx, 0); if ((err = ate_get_mac(sc, eaddr)) != 0) { /* @@ -310,12 +309,11 @@ ate_detach(device_t dev) KASSERT(sc != NULL, ("[ate: %d]: sc is NULL", __LINE__)); ifp = sc->ifp; if (device_is_attached(dev)) { + ether_ifdetach(ifp); ATE_LOCK(sc); - sc->flags |= ATE_FLAG_DETACHING; - atestop(sc); + atestop(sc); ATE_UNLOCK(sc); callout_drain(&sc->tick_ch); - ether_ifdetach(ifp); } if (sc->miibus != NULL) { device_delete_child(dev, sc->miibus); @@ -1107,11 +1105,9 @@ ateioctl(struct ifnet *ifp, u_long cmd, caddr_t data) & (IFF_PROMISC | IFF_ALLMULTI)) != 0) ate_rxfilter(sc); } else { - if ((sc->flags & ATE_FLAG_DETACHING) == 0) - ateinit_locked(sc); + ateinit_locked(sc); } } else if ((drv_flags & IFF_DRV_RUNNING) != 0) { - ifp->if_drv_flags &= ~IFF_DRV_RUNNING; atestop(sc); } sc->if_flags = flags; |