PERFORCE change 143335 for review
Julian Elischer
julian at FreeBSD.org
Thu Jun 12 01:00:42 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143335
Change 143335 by julian at julian_trafmon1 on 2008/06/12 01:00:07
IFC at 143330
Affected files ...
.. //depot/projects/vimage-commit2/src/sys/dev/smc/if_smc.c#3 integrate
.. //depot/projects/vimage-commit2/src/sys/dev/smc/if_smcvar.h#3 integrate
Differences ...
==== //depot/projects/vimage-commit2/src/sys/dev/smc/if_smc.c#3 (text+ko) ====
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/smc/if_smc.c,v 1.3 2008/06/11 07:26:02 benno Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/smc/if_smc.c,v 1.4 2008/06/12 00:38:54 benno Exp $");
/*
* Driver for SMSC LAN91C111, may work for older variants.
@@ -101,6 +101,7 @@
static void smc_init(void *);
static void smc_start(struct ifnet *);
+static void smc_stop(struct smc_softc *);
static int smc_ioctl(struct ifnet *, u_long, caddr_t);
static void smc_init_locked(struct smc_softc *);
@@ -278,6 +279,7 @@
error = 0;
sc->smc_dev = dev;
+ sc->smc_shutdown = 0;
/* Set up watchdog callout. */
callout_init(&sc->smc_watchdog, 1);
@@ -388,9 +390,19 @@
struct smc_softc *sc;
sc = device_get_softc(dev);
-
- callout_stop(&sc->smc_watchdog);
-
+ SMC_LOCK(sc);
+ sc->smc_shutdown = 1;
+ smc_stop(sc);
+ SMC_UNLOCK(sc);
+
+ if (sc->smc_tq != NULL) {
+ taskqueue_drain(sc->smc_tq, &sc->smc_intr);
+ taskqueue_drain(sc->smc_tq, &sc->smc_rx);
+ taskqueue_drain(sc->smc_tq, &sc->smc_tx);
+ taskqueue_free(sc->smc_tq);
+ sc->smc_tq = NULL;
+ }
+
#ifdef DEVICE_POLLING
if (sc->smc_ifp->if_capenable & IFCAP_POLLING)
ether_poll_deregister(sc->smc_ifp);
@@ -405,6 +417,7 @@
}
if (sc->smc_miibus != NULL) {
+ callout_stop(&sc->smc_mii_tick_ch);
device_delete_child(sc->smc_dev, sc->smc_miibus);
bus_generic_detach(sc->smc_dev);
}
@@ -422,9 +435,6 @@
bus_release_resource(sc->smc_dev, SYS_RES_IRQ, sc->smc_irq_rid,
sc->smc_irq);
- if (sc->smc_tq != NULL)
- taskqueue_free(sc->smc_tq);
-
if (mtx_initialized(&sc->smc_mtx))
mtx_destroy(&sc->smc_mtx);
@@ -530,7 +540,11 @@
sc = ifp->if_softc;
SMC_LOCK(sc);
-
+ if (sc->smc_shutdown == 1) {
+ SMC_UNLOCK(sc);
+ return;
+ }
+
if (sc->smc_pending == NULL) {
SMC_UNLOCK(sc);
goto next_packet;
@@ -633,6 +647,10 @@
mhead = mtail = NULL;
SMC_LOCK(sc);
+ if (sc->smc_shutdown == 1) {
+ SMC_UNLOCK(sc);
+ return;
+ }
packet = smc_read_1(sc, FIFO_RX);
while ((packet & FIFO_EMPTY) == 0) {
@@ -774,6 +792,11 @@
sc = ifp->if_softc;
SMC_LOCK(sc);
+ if (sc->smc_shutdown == 1) {
+ SMC_UNLOCK(sc);
+ return;
+ }
+
smc_select_bank(sc, 2);
/*
@@ -1224,6 +1247,12 @@
struct smc_softc *sc;
sc = (struct smc_softc *)arg;
+ SMC_LOCK(sc);
+ if (sc->smc_shutdown == 1) {
+ SMC_UNLOCK(sc);
+ return;
+ }
+ SMC_UNLOCK(sc);
device_printf(sc->smc_dev, "watchdog timeout\n");
taskqueue_enqueue_fast(sc->smc_tq, &sc->smc_intr);
}
==== //depot/projects/vimage-commit2/src/sys/dev/smc/if_smcvar.h#3 (text+ko) ====
@@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/smc/if_smcvar.h,v 1.3 2008/06/11 07:26:02 benno Exp $
+ * $FreeBSD: src/sys/dev/smc/if_smcvar.h,v 1.4 2008/06/12 00:38:54 benno Exp $
*
*/
@@ -35,6 +35,7 @@
u_int smc_chip;
u_int smc_rev;
u_int smc_mask;
+ u_int smc_shutdown;
/* Resources */
int smc_usemem;
More information about the p4-projects
mailing list