svn commit: r199557 - head/sys/arm/at91
John Baldwin
jhb at FreeBSD.org
Thu Nov 19 22:04:03 UTC 2009
Author: jhb
Date: Thu Nov 19 22:04:02 2009
New Revision: 199557
URL: http://svn.freebsd.org/changeset/base/199557
Log:
- 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
Modified:
head/sys/arm/at91/if_ate.c
Modified: head/sys/arm/at91/if_ate.c
==============================================================================
--- head/sys/arm/at91/if_ate.c Thu Nov 19 21:53:21 2009 (r199556)
+++ head/sys/arm/at91/if_ate.c Thu Nov 19 22:04:02 2009 (r199557)
@@ -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,
& (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;
More information about the svn-src-all
mailing list