summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-04-24 05:14:05 +0000
committerEric Anholt <anholt@freebsd.org>2003-04-24 05:14:05 +0000
commitaf3bfdef26b2d02ea4877e3d57601e57ffa4e95a (patch)
tree63012be0858d0aa0af1c45cc21f4a278f9a1113f
parentbcd527ee71043478d27ec3e5b611c9f34bf4f191 (diff)
Remove the ioctl_count variable from the device. A reference is held to the
fp throughout the ioctl syscall, so the device can't be closed out from under us.
-rw-r--r--bsd-core/drmP.h1
-rw-r--r--bsd-core/drm_drv.c15
-rw-r--r--bsd/drmP.h1
-rw-r--r--bsd/drm_drv.h15
4 files changed, 0 insertions, 32 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index 1dae1201..236dab6d 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -352,7 +352,6 @@ struct drm_device {
struct lock dev_lock; /* For others */
/* Usage Counters */
int open_count; /* Outstanding files open */
- atomic_t ioctl_count; /* Outstanding IOCTLs pending */
int buf_use; /* Buffers in use -- cannot alloc */
atomic_t buf_alloc; /* Buffer allocation in progress */
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 8f08da46..779f4ef4 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -424,7 +424,6 @@ static int DRM(setup)( drm_device_t *dev )
int i;
DRIVER_PRESETUP();
- atomic_set( &dev->ioctl_count, 0 );
dev->buf_use = 0;
atomic_set( &dev->buf_alloc, 0 );
@@ -1001,12 +1000,6 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
device_unbusy(dev->device);
#endif
if ( !--dev->open_count ) {
- if (atomic_read(&dev->ioctl_count)) {
- DRM_ERROR("Device busy: %ld\n",
- (unsigned long)atomic_read( &dev->ioctl_count ));
- DRM_SPINUNLOCK( &dev->count_lock );
- return DRM_ERR(EBUSY);
- }
DRM_SPINUNLOCK( &dev->count_lock );
return DRM(takedown)( dev );
}
@@ -1027,7 +1020,6 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
int nr = DRM_IOCTL_NR(cmd);
DRM_PRIV;
- atomic_inc( &dev->ioctl_count );
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
++priv->ioctl_count;
@@ -1041,21 +1033,17 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
switch (cmd) {
case FIONBIO:
- atomic_dec(&dev->ioctl_count);
return 0;
case FIOASYNC:
- atomic_dec(&dev->ioctl_count);
dev->flags |= FASYNC;
return 0;
#ifdef __FreeBSD__
case FIOSETOWN:
- atomic_dec(&dev->ioctl_count);
return fsetown(*(int *)data, &dev->buf_sigio);
case FIOGETOWN:
- atomic_dec(&dev->ioctl_count);
#if (__FreeBSD_version >= 500000)
*(int *) data = fgetown(&dev->buf_sigio);
#else
@@ -1065,12 +1053,10 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
case TIOCSPGRP:
- atomic_dec(&dev->ioctl_count);
dev->buf_pgid = *(int *)data;
return 0;
case TIOCGPGRP:
- atomic_dec(&dev->ioctl_count);
*(int *)data = dev->buf_pgid;
return 0;
#endif /* __NetBSD__ */
@@ -1093,7 +1079,6 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
}
}
- atomic_dec( &dev->ioctl_count );
return DRM_ERR(retcode);
}
diff --git a/bsd/drmP.h b/bsd/drmP.h
index 1dae1201..236dab6d 100644
--- a/bsd/drmP.h
+++ b/bsd/drmP.h
@@ -352,7 +352,6 @@ struct drm_device {
struct lock dev_lock; /* For others */
/* Usage Counters */
int open_count; /* Outstanding files open */
- atomic_t ioctl_count; /* Outstanding IOCTLs pending */
int buf_use; /* Buffers in use -- cannot alloc */
atomic_t buf_alloc; /* Buffer allocation in progress */
diff --git a/bsd/drm_drv.h b/bsd/drm_drv.h
index 8f08da46..779f4ef4 100644
--- a/bsd/drm_drv.h
+++ b/bsd/drm_drv.h
@@ -424,7 +424,6 @@ static int DRM(setup)( drm_device_t *dev )
int i;
DRIVER_PRESETUP();
- atomic_set( &dev->ioctl_count, 0 );
dev->buf_use = 0;
atomic_set( &dev->buf_alloc, 0 );
@@ -1001,12 +1000,6 @@ int DRM(close)(dev_t kdev, int flags, int fmt, DRM_STRUCTPROC *p)
device_unbusy(dev->device);
#endif
if ( !--dev->open_count ) {
- if (atomic_read(&dev->ioctl_count)) {
- DRM_ERROR("Device busy: %ld\n",
- (unsigned long)atomic_read( &dev->ioctl_count ));
- DRM_SPINUNLOCK( &dev->count_lock );
- return DRM_ERR(EBUSY);
- }
DRM_SPINUNLOCK( &dev->count_lock );
return DRM(takedown)( dev );
}
@@ -1027,7 +1020,6 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
int nr = DRM_IOCTL_NR(cmd);
DRM_PRIV;
- atomic_inc( &dev->ioctl_count );
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
++priv->ioctl_count;
@@ -1041,21 +1033,17 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
switch (cmd) {
case FIONBIO:
- atomic_dec(&dev->ioctl_count);
return 0;
case FIOASYNC:
- atomic_dec(&dev->ioctl_count);
dev->flags |= FASYNC;
return 0;
#ifdef __FreeBSD__
case FIOSETOWN:
- atomic_dec(&dev->ioctl_count);
return fsetown(*(int *)data, &dev->buf_sigio);
case FIOGETOWN:
- atomic_dec(&dev->ioctl_count);
#if (__FreeBSD_version >= 500000)
*(int *) data = fgetown(&dev->buf_sigio);
#else
@@ -1065,12 +1053,10 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
#endif /* __FreeBSD__ */
#ifdef __NetBSD__
case TIOCSPGRP:
- atomic_dec(&dev->ioctl_count);
dev->buf_pgid = *(int *)data;
return 0;
case TIOCGPGRP:
- atomic_dec(&dev->ioctl_count);
*(int *)data = dev->buf_pgid;
return 0;
#endif /* __NetBSD__ */
@@ -1093,7 +1079,6 @@ int DRM(ioctl)(dev_t kdev, u_long cmd, caddr_t data, int flags,
}
}
- atomic_dec( &dev->ioctl_count );
return DRM_ERR(retcode);
}