提交 d2ff3ec8 编写于 作者: J Janne Grunau 提交者: Mauro Carvalho Chehab

V4L/DVB (11230): hdpvr: return immediately from hdpvr_poll if data is available

simplifies check for available data with hdpvr_get_next_buffer
Signed-off-by: NJanne Grunau <j@jannau.net>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 a50ab291
......@@ -479,6 +479,7 @@ static ssize_t hdpvr_read(struct file *file, char __user *buffer, size_t count,
static unsigned int hdpvr_poll(struct file *filp, poll_table *wait)
{
struct hdpvr_buffer *buf = NULL;
struct hdpvr_fh *fh = (struct hdpvr_fh *)filp->private_data;
struct hdpvr_device *dev = fh->dev;
unsigned int mask = 0;
......@@ -499,19 +500,14 @@ static unsigned int hdpvr_poll(struct file *filp, poll_table *wait)
}
mutex_unlock(&dev->io_mutex);
poll_wait(filp, &dev->wait_data, wait);
mutex_lock(&dev->io_mutex);
if (!list_empty(&dev->rec_buff_list)) {
struct hdpvr_buffer *buf = list_entry(dev->rec_buff_list.next,
struct hdpvr_buffer,
buff_list);
if (buf->status == BUFSTAT_READY)
mask |= POLLIN | POLLRDNORM;
buf = hdpvr_get_next_buffer(dev);
/* only wait if no data is available */
if (!buf || buf->status != BUFSTAT_READY) {
poll_wait(filp, &dev->wait_data, wait);
buf = hdpvr_get_next_buffer(dev);
}
mutex_unlock(&dev->io_mutex);
if (buf && buf->status == BUFSTAT_READY)
mask |= POLLIN | POLLRDNORM;
return mask;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册