diff options
author | Janne Grunau <j@jannau.net> | 2009-03-26 18:32:54 +0100 |
---|---|---|
committer | Janne Grunau <j@jannau.net> | 2009-03-26 18:32:54 +0100 |
commit | 3d73a21a3b0fb96a08c796016ae66cb734327490 (patch) | |
tree | 664cc89b106dfb7ca57a469a1efb3c409c8aaccd /linux/drivers/media | |
parent | b16183f4e679f7248f72e89d10dfcf73cfb83d49 (diff) | |
download | mediapointer-dvb-s2-3d73a21a3b0fb96a08c796016ae66cb734327490.tar.gz mediapointer-dvb-s2-3d73a21a3b0fb96a08c796016ae66cb734327490.tar.bz2 |
hdpvr: return immediately from hdpvr_poll if data is available
From: Janne Grunau <j@jannau.net>
simplifies check for available data with hdpvr_get_next_buffer
Priority: normal
Signed-off-by: Janne Grunau <j@jannau.net>
Diffstat (limited to 'linux/drivers/media')
-rw-r--r-- | linux/drivers/media/video/hdpvr/hdpvr-video.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/linux/drivers/media/video/hdpvr/hdpvr-video.c b/linux/drivers/media/video/hdpvr/hdpvr-video.c index 9560e19d7..e9078cded 100644 --- a/linux/drivers/media/video/hdpvr/hdpvr-video.c +++ b/linux/drivers/media/video/hdpvr/hdpvr-video.c @@ -479,6 +479,7 @@ err: 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; } |