diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-10-01 05:23:53 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-10-01 16:14:27 -0400 |
commit | 7eaf49667e23a11a1f6ec88dad51ad0e93b1445d (patch) | |
tree | 5991c6f693139ba344b54c0b6869134c8bab57e9 /drivers | |
parent | f659f0e7a66245295e1930ad21dfabf80c1403bf (diff) |
[media] ivtv: fix v4l2-compliance errors for the radio device
- fix error code when attempting to read from write-only streams.
- fix error code when attempting to write to read-only streams.
- don't start capturing when polling on a radio node.
- give the radio node its own file operations struct.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/pci/ivtv/ivtv-fileops.c | 5 | ||||
-rw-r--r-- | drivers/media/pci/ivtv/ivtv-streams.c | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv/ivtv-fileops.c index 7f2eb5f62fd1..9caffd8aa995 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c | |||
@@ -435,7 +435,7 @@ int ivtv_start_capture(struct ivtv_open_id *id) | |||
435 | s->type == IVTV_DEC_STREAM_TYPE_YUV || | 435 | s->type == IVTV_DEC_STREAM_TYPE_YUV || |
436 | s->type == IVTV_DEC_STREAM_TYPE_VOUT) { | 436 | s->type == IVTV_DEC_STREAM_TYPE_VOUT) { |
437 | /* you cannot read from these stream types. */ | 437 | /* you cannot read from these stream types. */ |
438 | return -EPERM; | 438 | return -EINVAL; |
439 | } | 439 | } |
440 | 440 | ||
441 | /* Try to claim this stream. */ | 441 | /* Try to claim this stream. */ |
@@ -564,7 +564,7 @@ static ssize_t ivtv_write(struct file *filp, const char __user *user_buf, size_t | |||
564 | s->type != IVTV_DEC_STREAM_TYPE_YUV && | 564 | s->type != IVTV_DEC_STREAM_TYPE_YUV && |
565 | s->type != IVTV_DEC_STREAM_TYPE_VOUT) | 565 | s->type != IVTV_DEC_STREAM_TYPE_VOUT) |
566 | /* not decoder streams */ | 566 | /* not decoder streams */ |
567 | return -EPERM; | 567 | return -EINVAL; |
568 | 568 | ||
569 | /* Try to claim this stream */ | 569 | /* Try to claim this stream */ |
570 | if (ivtv_claim_stream(id, s->type)) | 570 | if (ivtv_claim_stream(id, s->type)) |
@@ -775,6 +775,7 @@ unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table *wait) | |||
775 | 775 | ||
776 | /* Start a capture if there is none */ | 776 | /* Start a capture if there is none */ |
777 | if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) && | 777 | if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) && |
778 | s->type != IVTV_ENC_STREAM_TYPE_RAD && | ||
778 | (req_events & (POLLIN | POLLRDNORM))) { | 779 | (req_events & (POLLIN | POLLRDNORM))) { |
779 | int rc; | 780 | int rc; |
780 | 781 | ||
diff --git a/drivers/media/pci/ivtv/ivtv-streams.c b/drivers/media/pci/ivtv/ivtv-streams.c index 7b8648a827f5..3455f465ff13 100644 --- a/drivers/media/pci/ivtv/ivtv-streams.c +++ b/drivers/media/pci/ivtv/ivtv-streams.c | |||
@@ -65,6 +65,14 @@ static const struct v4l2_file_operations ivtv_v4l2_dec_fops = { | |||
65 | .poll = ivtv_v4l2_dec_poll, | 65 | .poll = ivtv_v4l2_dec_poll, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static const struct v4l2_file_operations ivtv_v4l2_radio_fops = { | ||
69 | .owner = THIS_MODULE, | ||
70 | .open = ivtv_v4l2_open, | ||
71 | .unlocked_ioctl = video_ioctl2, | ||
72 | .release = ivtv_v4l2_close, | ||
73 | .poll = ivtv_v4l2_enc_poll, | ||
74 | }; | ||
75 | |||
68 | #define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ | 76 | #define IVTV_V4L2_DEC_MPG_OFFSET 16 /* offset from 0 to register decoder mpg v4l2 minors on */ |
69 | #define IVTV_V4L2_ENC_PCM_OFFSET 24 /* offset from 0 to register pcm v4l2 minors on */ | 77 | #define IVTV_V4L2_ENC_PCM_OFFSET 24 /* offset from 0 to register pcm v4l2 minors on */ |
70 | #define IVTV_V4L2_ENC_YUV_OFFSET 32 /* offset from 0 to register yuv v4l2 minors on */ | 78 | #define IVTV_V4L2_ENC_YUV_OFFSET 32 /* offset from 0 to register yuv v4l2 minors on */ |
@@ -116,7 +124,7 @@ static struct { | |||
116 | VFL_TYPE_RADIO, 0, | 124 | VFL_TYPE_RADIO, 0, |
117 | PCI_DMA_NONE, 1, | 125 | PCI_DMA_NONE, 1, |
118 | V4L2_CAP_RADIO | V4L2_CAP_TUNER, | 126 | V4L2_CAP_RADIO | V4L2_CAP_TUNER, |
119 | &ivtv_v4l2_enc_fops | 127 | &ivtv_v4l2_radio_fops |
120 | }, | 128 | }, |
121 | { /* IVTV_DEC_STREAM_TYPE_MPG */ | 129 | { /* IVTV_DEC_STREAM_TYPE_MPG */ |
122 | "decoder MPG", | 130 | "decoder MPG", |