aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorJanne Grunau <j@jannau.net>2009-03-26 13:32:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:42 -0400
commitd2ff3ec81628cbf9470c496b3d0c0780165643f5 (patch)
tree75724b9a5300ef5b2c2a13299cffbfb49677c6f9 /drivers/media/video
parenta50ab29185a9ec31e5a6999e53add0508653e889 (diff)
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: Janne Grunau <j@jannau.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/hdpvr/hdpvr-video.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/drivers/media/video/hdpvr/hdpvr-video.c b/drivers/media/video/hdpvr/hdpvr-video.c
index 9560e19d7cf0..e9078cdedb28 100644
--- a/drivers/media/video/hdpvr/hdpvr-video.c
+++ b/drivers/media/video/hdpvr/hdpvr-video.c
@@ -479,6 +479,7 @@ err:
479 479
480static unsigned int hdpvr_poll(struct file *filp, poll_table *wait) 480static unsigned int hdpvr_poll(struct file *filp, poll_table *wait)
481{ 481{
482 struct hdpvr_buffer *buf = NULL;
482 struct hdpvr_fh *fh = (struct hdpvr_fh *)filp->private_data; 483 struct hdpvr_fh *fh = (struct hdpvr_fh *)filp->private_data;
483 struct hdpvr_device *dev = fh->dev; 484 struct hdpvr_device *dev = fh->dev;
484 unsigned int mask = 0; 485 unsigned int mask = 0;
@@ -499,19 +500,14 @@ static unsigned int hdpvr_poll(struct file *filp, poll_table *wait)
499 } 500 }
500 mutex_unlock(&dev->io_mutex); 501 mutex_unlock(&dev->io_mutex);
501 502
502 poll_wait(filp, &dev->wait_data, wait); 503 buf = hdpvr_get_next_buffer(dev);
503 504 /* only wait if no data is available */
504 mutex_lock(&dev->io_mutex); 505 if (!buf || buf->status != BUFSTAT_READY) {
505 if (!list_empty(&dev->rec_buff_list)) { 506 poll_wait(filp, &dev->wait_data, wait);
506 507 buf = hdpvr_get_next_buffer(dev);
507 struct hdpvr_buffer *buf = list_entry(dev->rec_buff_list.next,
508 struct hdpvr_buffer,
509 buff_list);
510
511 if (buf->status == BUFSTAT_READY)
512 mask |= POLLIN | POLLRDNORM;
513 } 508 }
514 mutex_unlock(&dev->io_mutex); 509 if (buf && buf->status == BUFSTAT_READY)
510 mask |= POLLIN | POLLRDNORM;
515 511
516 return mask; 512 return mask;
517} 513}