From owner-p4-releng@FreeBSD.ORG Tue Sep 30 15:02:19 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1D79016A4C0; Tue, 30 Sep 2003 15:02:19 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EDA7316A4B3 for ; Tue, 30 Sep 2003 15:02:18 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CF0044017 for ; Tue, 30 Sep 2003 15:02:18 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8UM2IXJ026603 for ; Tue, 30 Sep 2003 15:02:18 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8UM2HsO026596 for perforce@freebsd.org; Tue, 30 Sep 2003 15:02:17 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 15:02:17 -0700 (PDT) Message-Id: <200309302202.h8UM2HsO026596@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38924 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 22:02:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=38924 Change 38924 by imp@imp_koguchi on 2003/09/30 15:01:37 More tweaking with input from jhb. phk has indicated he'd like to see new/old examples, so I'll try to do that later. gotta get back to work. Affected files ... .. //depot/doc/strawman-driver.c#5 edit Differences ... ==== //depot/doc/strawman-driver.c#5 (text+ko) ==== @@ -40,6 +40,7 @@ foo_wakeup_my_sleepers(foo_softc *sc) { sc->dead = 1; /* Race #1, c */ + sc->d->si_drv1 = NULL; /* Race #2, b */ mtx_lock(&sc->mtx); cv_broadcast(&sc->cv); mtx_unlock(&sc->mtx); @@ -67,23 +68,23 @@ { sc = device_get_softc(dev); - sc->d->si_drv1 = NULL /* Race #2, b */ + foo_wakeup_my_sleepers(sc); foo_disable_intr(sc); /* disable hardware intr ??? */ /* Everybody active here */ - callout_reset(&sc->stat_ch, hz, fxp_tick, sc); + if (callout_stop(&sc->stat_ch, hz, fxp_tick, sc) == 0) + printf("Maybe we just lost a race\n"); /* Network, ISR and devsw active */ bus_teardown_intr(sc->dev, sc->irq, sc->ih); - /* Network and devsw active */ + /* network and devsw active */ + destroy_dev(sc->d); + + /* Network active */ ether_ifdetach(&sc->arpcom.ac_if); sc->ih = NULL; - foo_wakeup_my_sleepers(sc); - - /* devsw active */ - destroy_dev(sc->d); /* only mutex alive */ mtx_destroy(&sc->mtx);