Date: Sat, 2 Jun 2007 20:07:32 GMT From: Rui Paulo <rpaulo@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 120794 for review Message-ID: <200706022007.l52K7Wsx060754@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=120794 Change 120794 by rpaulo@rpaulo_epsilon on 2007/06/02 20:06:56 Fix a couple of problems with locking: * don't use spin mutexes. * remove "_mtx" from the mutex description * in asmc_intr(), only lock during the inb instruction. * move sc_mtx to the beginning of the softc struct. Comments by: Attilio Rao Affected files ... .. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#9 edit .. //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#5 edit Differences ... ==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#9 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#8 $ + * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmc.c#9 $ * */ @@ -240,7 +240,7 @@ model = asmc_match(dev); - mtx_init(&sc->sc_mtx, "asmc_mtx", NULL, MTX_SPIN); + mtx_init(&sc->sc_mtx, "asmc", NULL, MTX_DEF); asmc_init(dev); @@ -517,7 +517,7 @@ int i, error = 1; struct asmc_softc *sc = device_get_softc(dev); - mtx_lock_spin(&sc->sc_mtx); + mtx_lock(&sc->sc_mtx); outb(ASMC_CMDPORT, ASMC_CMDREAD); if (asmc_wait(dev, 0x0c)) @@ -539,7 +539,7 @@ error = 0; out: - mtx_unlock_spin(&sc->sc_mtx); + mtx_unlock(&sc->sc_mtx); return error; } @@ -550,7 +550,7 @@ int i, error = -1; struct asmc_softc *sc = device_get_softc(dev); - mtx_lock_spin(&sc->sc_mtx); + mtx_lock(&sc->sc_mtx); outb(ASMC_CMDPORT, ASMC_CMDWRITE); if (asmc_wait(dev, 0x0c)) @@ -572,7 +572,7 @@ error = 0; out: - mtx_unlock_spin(&sc->sc_mtx); + mtx_unlock(&sc->sc_mtx); return error; @@ -758,9 +758,9 @@ device_t dev = (device_t) arg; struct asmc_softc *sc = device_get_softc(dev); - mtx_lock_spin(&sc->sc_mtx); - + mtx_lock(&sc->sc_mtx); type = inb(ASMC_INTPORT); + mtx_unlock(&sc->sc_mtx); switch (type) { case ASMC_SMS_INTFF: @@ -776,8 +776,6 @@ device_printf(dev, "%s unknown interrupt\n", __func__); } - mtx_unlock_spin(&sc->sc_mtx); - return 0; } ==== //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#5 (text+ko) ==== @@ -23,7 +23,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#4 $ + * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/asmc/asmcvar.h#5 $ * */ @@ -31,6 +31,7 @@ struct asmc_softc { device_t sc_dev; + struct mtx sc_mtx; int sc_nfan; @@ -49,8 +50,6 @@ int sc_rid; struct resource *sc_res; void *sc_cookie; - - struct mtx sc_mtx; }; struct asmc_model {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200706022007.l52K7Wsx060754>