aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/gpio
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2021-11-30 22:03:26 +0000
committerWarner Losh <imp@FreeBSD.org>2021-11-30 22:18:01 +0000
commit1c7d15b030718d9d8cc70916fe3216a19f30896b (patch)
treec9b2236cd5418385468559d9c2d39f372cac0637 /sys/dev/gpio
parent25c49c426c6b6067f7374fae39fb38333cd11e0c (diff)
Diffstat (limited to 'sys/dev/gpio')
-rw-r--r--sys/dev/gpio/gpiopps.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/dev/gpio/gpiopps.c b/sys/dev/gpio/gpiopps.c
index 4700acf19bcd..741bfa4498a6 100644
--- a/sys/dev/gpio/gpiopps.c
+++ b/sys/dev/gpio/gpiopps.c
@@ -73,9 +73,7 @@ gpiopps_open(struct cdev *dev, int flags, int fmt, struct thread *td)
/* We can't be unloaded while open, so mark ourselves BUSY. */
mtx_lock(&sc->pps_mtx);
- if (device_get_state(sc->dev) < DS_BUSY) {
- device_busy(sc->dev);
- }
+ device_busy(sc->dev);
mtx_unlock(&sc->pps_mtx);
return 0;
@@ -86,10 +84,6 @@ gpiopps_close(struct cdev *dev, int flags, int fmt, struct thread *td)
{
struct pps_softc *sc = dev->si_drv1;
- /*
- * Un-busy on last close. We rely on the vfs counting stuff to only call
- * this routine on last-close, so we don't need any open-count logic.
- */
mtx_lock(&sc->pps_mtx);
device_unbusy(sc->dev);
mtx_unlock(&sc->pps_mtx);
@@ -113,6 +107,7 @@ gpiopps_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thre
static struct cdevsw pps_cdevsw = {
.d_version = D_VERSION,
+ .d_flags = D_TRACKCLOSE,
.d_open = gpiopps_open,
.d_close = gpiopps_close,
.d_ioctl = gpiopps_ioctl,