From 092cb1258fa2435e3efb0ea5435e7469af39083b Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 17 Mar 2005 20:45:24 +0000 Subject: When locking a MTX_SPIN, one needs to use mtx_lock_spin. Lock the timeout routine as well. Submitted by: bde --- sys/dev/ppbus/pps.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sys/dev/ppbus') diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c index c66e39d5ef0f..e5c2afd3bdbe 100644 --- a/sys/dev/ppbus/pps.c +++ b/sys/dev/ppbus/pps.c @@ -257,6 +257,7 @@ ppshcpoll(void *arg) if (!(sc->busy & ~1)) return; + mtx_lock_spin(&sc->mtx); sc->timeout = timeout(ppshcpoll, sc, 1); i = ppb_rdtr(sc->ppbus); if (i == sc->lastdata) @@ -272,6 +273,7 @@ ppshcpoll(void *arg) k += k; } sc->lastdata = i; + mtx_unlock_spin(&sc->mtx); } static void @@ -281,10 +283,10 @@ ppsintr(void *arg) struct pps_data *sc = DEVTOSOFTC(ppsdev); device_t ppbus = sc->ppbus; - mtx_lock(&sc->mtx); + mtx_lock_spin(&sc->mtx); pps_capture(&sc->pps[0]); if (!(ppb_rstr(ppbus) & nACK)) { - mtx_unlock(&sc->mtx); + mtx_unlock_spin(&sc->mtx); return; } if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT) @@ -292,7 +294,7 @@ ppsintr(void *arg) pps_event(&sc->pps[0], PPS_CAPTUREASSERT); if (sc->pps[0].ppsparam.mode & PPS_ECHOASSERT) ppb_wctr(ppbus, IRQENABLE); - mtx_unlock(&sc->mtx); + mtx_unlock_spin(&sc->mtx); } static int @@ -302,9 +304,9 @@ ppsioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t int subdev = (intptr_t)dev->si_drv2; int err; - mtx_lock(&sc->mtx); + mtx_lock_spin(&sc->mtx); err = pps_ioctl(cmd, data, &sc->pps[subdev]); - mtx_unlock(&sc->mtx); + mtx_unlock_spin(&sc->mtx); return (err); } -- cgit v1.3