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 */
int i;
DRIVER_PRESETUP();
- atomic_set( &dev->ioctl_count, 0 );
dev->buf_use = 0;
atomic_set( &dev->buf_alloc, 0 );
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 );
}
int nr = DRM_IOCTL_NR(cmd);
DRM_PRIV;
- atomic_inc( &dev->ioctl_count );
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
++priv->ioctl_count;
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
#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__ */
}
}
- atomic_dec( &dev->ioctl_count );
return DRM_ERR(retcode);
}
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 */
int i;
DRIVER_PRESETUP();
- atomic_set( &dev->ioctl_count, 0 );
dev->buf_use = 0;
atomic_set( &dev->buf_alloc, 0 );
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 );
}
int nr = DRM_IOCTL_NR(cmd);
DRM_PRIV;
- atomic_inc( &dev->ioctl_count );
atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
++priv->ioctl_count;
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
#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__ */
}
}
- atomic_dec( &dev->ioctl_count );
return DRM_ERR(retcode);
}