summaryrefslogtreecommitdiff
path: root/linux/drm_fops.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drm_fops.h')
-rw-r--r--linux/drm_fops.h14
1 files changed, 2 insertions, 12 deletions
diff --git a/linux/drm_fops.h b/linux/drm_fops.h
index 9c2135fe..3d4bffa5 100644
--- a/linux/drm_fops.h
+++ b/linux/drm_fops.h
@@ -38,7 +38,7 @@
int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev)
{
- kdev_t minor = MINOR(inode->i_rdev);
+ int minor = minor(inode->i_rdev);
drm_file_t *priv;
if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */
@@ -125,31 +125,21 @@ ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off)
int avail;
int send;
int cur;
- DECLARE_WAITQUEUE(wait, current);
DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp);
- add_wait_queue(&dev->buf_readers, &wait);
- set_current_state(TASK_INTERRUPTIBLE);
while (dev->buf_rp == dev->buf_wp) {
DRM_DEBUG(" sleeping\n");
if (filp->f_flags & O_NONBLOCK) {
- remove_wait_queue(&dev->buf_readers, &wait);
- set_current_state(TASK_RUNNING);
return -EAGAIN;
}
- schedule(); /* wait for dev->buf_readers */
+ interruptible_sleep_on(&dev->buf_readers);
if (signal_pending(current)) {
DRM_DEBUG(" interrupted\n");
- remove_wait_queue(&dev->buf_readers, &wait);
- set_current_state(TASK_RUNNING);
return -ERESTARTSYS;
}
DRM_DEBUG(" awake\n");
- set_current_state(TASK_INTERRUPTIBLE);
}
- remove_wait_queue(&dev->buf_readers, &wait);
- set_current_state(TASK_RUNNING);
left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ;
avail = DRM_BSZ - left;