aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/pci/cx18/cx18-fileops.c25
-rw-r--r--drivers/media/pci/cx18/cx18-ioctl.c3
2 files changed, 20 insertions, 8 deletions
diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18/cx18-fileops.c
index d245445eea2d..df837408efd5 100644
--- a/drivers/media/pci/cx18/cx18-fileops.c
+++ b/drivers/media/pci/cx18/cx18-fileops.c
@@ -34,6 +34,7 @@
34#include "cx18-controls.h" 34#include "cx18-controls.h"
35#include "cx18-ioctl.h" 35#include "cx18-ioctl.h"
36#include "cx18-cards.h" 36#include "cx18-cards.h"
37#include <media/v4l2-event.h>
37 38
38/* This function tries to claim the stream for a specific file descriptor. 39/* This function tries to claim the stream for a specific file descriptor.
39 If no one else is using this stream then the stream is claimed and 40 If no one else is using this stream then the stream is claimed and
@@ -609,13 +610,16 @@ ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count,
609 610
610unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait) 611unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait)
611{ 612{
613 unsigned long req_events = poll_requested_events(wait);
612 struct cx18_open_id *id = file2id(filp); 614 struct cx18_open_id *id = file2id(filp);
613 struct cx18 *cx = id->cx; 615 struct cx18 *cx = id->cx;
614 struct cx18_stream *s = &cx->streams[id->type]; 616 struct cx18_stream *s = &cx->streams[id->type];
615 int eof = test_bit(CX18_F_S_STREAMOFF, &s->s_flags); 617 int eof = test_bit(CX18_F_S_STREAMOFF, &s->s_flags);
618 unsigned res = 0;
616 619
617 /* Start a capture if there is none */ 620 /* Start a capture if there is none */
618 if (!eof && !test_bit(CX18_F_S_STREAMING, &s->s_flags)) { 621 if (!eof && !test_bit(CX18_F_S_STREAMING, &s->s_flags) &&
622 (req_events & (POLLIN | POLLRDNORM))) {
619 int rc; 623 int rc;
620 624
621 mutex_lock(&cx->serialize_lock); 625 mutex_lock(&cx->serialize_lock);
@@ -632,21 +636,26 @@ unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait)
632 if ((s->vb_type == V4L2_BUF_TYPE_VIDEO_CAPTURE) && 636 if ((s->vb_type == V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
633 (id->type == CX18_ENC_STREAM_TYPE_YUV)) { 637 (id->type == CX18_ENC_STREAM_TYPE_YUV)) {
634 int videobuf_poll = videobuf_poll_stream(filp, &s->vbuf_q, wait); 638 int videobuf_poll = videobuf_poll_stream(filp, &s->vbuf_q, wait);
639
640 if (v4l2_event_pending(&id->fh))
641 res |= POLLPRI;
635 if (eof && videobuf_poll == POLLERR) 642 if (eof && videobuf_poll == POLLERR)
636 return POLLHUP; 643 return res | POLLHUP;
637 else 644 return res | videobuf_poll;
638 return videobuf_poll;
639 } 645 }
640 646
641 /* add stream's waitq to the poll list */ 647 /* add stream's waitq to the poll list */
642 CX18_DEBUG_HI_FILE("Encoder poll\n"); 648 CX18_DEBUG_HI_FILE("Encoder poll\n");
643 poll_wait(filp, &s->waitq, wait); 649 if (v4l2_event_pending(&id->fh))
650 res |= POLLPRI;
651 else
652 poll_wait(filp, &s->waitq, wait);
644 653
645 if (atomic_read(&s->q_full.depth)) 654 if (atomic_read(&s->q_full.depth))
646 return POLLIN | POLLRDNORM; 655 return res | POLLIN | POLLRDNORM;
647 if (eof) 656 if (eof)
648 return POLLHUP; 657 return res | POLLHUP;
649 return 0; 658 return res;
650} 659}
651 660
652int cx18_v4l2_mmap(struct file *file, struct vm_area_struct *vma) 661int cx18_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c
index 0230b0f3c25b..6f8324d4be6d 100644
--- a/drivers/media/pci/cx18/cx18-ioctl.c
+++ b/drivers/media/pci/cx18/cx18-ioctl.c
@@ -39,6 +39,7 @@
39#include "cx18-cards.h" 39#include "cx18-cards.h"
40#include "cx18-av-core.h" 40#include "cx18-av-core.h"
41#include <media/tveeprom.h> 41#include <media/tveeprom.h>
42#include <media/v4l2-event.h>
42 43
43u16 cx18_service2vbi(int type) 44u16 cx18_service2vbi(int type)
44{ 45{
@@ -1117,6 +1118,8 @@ static const struct v4l2_ioctl_ops cx18_ioctl_ops = {
1117 .vidioc_querybuf = cx18_querybuf, 1118 .vidioc_querybuf = cx18_querybuf,
1118 .vidioc_qbuf = cx18_qbuf, 1119 .vidioc_qbuf = cx18_qbuf,
1119 .vidioc_dqbuf = cx18_dqbuf, 1120 .vidioc_dqbuf = cx18_dqbuf,
1121 .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
1122 .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
1120}; 1123};
1121 1124
1122void cx18_set_funcs(struct video_device *vdev) 1125void cx18_set_funcs(struct video_device *vdev)