aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/gpio/gpiopps.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/gpio/gpiopps.c')
-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,