DragonFly BSD
DragonFly commits List (threaded) for 2005-06
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sys/dev/netif/sf if_sf.c


From: Sepherosa Ziehau <sepherosa@xxxxxxxxx>
Date: Mon, 13 Jun 2005 07:19:34 +0800

 static int sf_detach(dev)
 	device_t		dev;
 {
-	struct sf_softc		*sc;
-	struct ifnet		*ifp;
-	int			s;
-
-	s = splimp();
+	struct sf_softc *sc = device_get_softc(dev);
+	struct ifnet *ifp = &sc->arpcom.ac_if;
 
-	sc = device_get_softc(dev);
-	ifp = &sc->arpcom.ac_if;
+	crit_enter();
 
-	ether_ifdetach(ifp);
-	sf_stop(sc);
+	if (device_is_attached(dev)) {
+		ether_ifdetach(ifp);
+		sf_stop(sc);

Should we call sf_stop() before ether_ifattach()?

+	}
 
-	bus_generic_detach(dev);
 	device_delete_child(dev, sc->sf_miibus);

device_delete_child() here should be called based on (sc->sf_miibus != NULL)

+	bus_generic_detach(dev);

Best Regards,
sephe

On 6/13/05, Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> joerg       2005/06/12 10:29:49 PDT
> 
> DragonFly src repository
> 
>   Modified files:
>     sys/dev/netif/sf     if_sf.c
>   Log:
>   - convert to critical sections
>   - setup interrupt last, no need to protect attach against races
>   - use M_WAITOK for contigmalloc
>   - use sf_detach for common error handling
> 
>   Revision  Changes    Path
>   1.20      +53 -69    src/sys/dev/netif/sf/if_sf.c
> 
> 
> http://www.dragonflybsd.org/cvsweb/src/sys/dev/netif/sf/if_sf.c.diff?r1=1.19&r2=1.20&f=u
> 


-- 
Live Free or Die




[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]