summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2005-03-17 20:45:24 +0000
committerimp <imp@FreeBSD.org>2005-03-17 20:45:24 +0000
commit7c03e162bd8ef671e67f8d6c2d0cce338669563a (patch)
treef6a765f6abae7956190f012123c8ae180c1e6bcd
parent6789e655302fcfd3e4216b103ff2ad588ced3643 (diff)
downloadFreeBSD-src-7c03e162bd8ef671e67f8d6c2d0cce338669563a.zip
FreeBSD-src-7c03e162bd8ef671e67f8d6c2d0cce338669563a.tar.gz
When locking a MTX_SPIN, one needs to use mtx_lock_spin.
Lock the timeout routine as well. Submitted by: bde
-rw-r--r--sys/dev/ppbus/pps.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/ppbus/pps.c b/sys/dev/ppbus/pps.c
index c66e39d..e5c2afd 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);
}
OpenPOWER on IntegriCloud