summaryrefslogtreecommitdiff
path: root/linux-core/drm_fops.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-core/drm_fops.c')
-rw-r--r--linux-core/drm_fops.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index d8e9112f..9c2135fe 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -125,21 +125,31 @@ 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;
}
- interruptible_sleep_on(&dev->buf_readers);
+ schedule(); /* wait for 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;