diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-09-06 09:07:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-04 21:47:41 -0500 |
commit | 20deebfe17b20ded00ba404adbcd014eb2b024c1 (patch) | |
tree | f682657f8782286204a5179dc854153733c10ec8 | |
parent | 319a55fbe4c1d3bbe8abe3900e6dc91440ec9b0b (diff) |
[media] em28xx: fix tuner/frequency handling
v4l2-compliance found problems with frequency clamping that wasn't
reported correctly and missing tuner index checks.
Also removed unnecessary tuner type checks (these are now done by the
v4l2 core).
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-video.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index b71df42aa7bb..89cbfaf17bda 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c | |||
@@ -1322,7 +1322,6 @@ static int vidioc_g_tuner(struct file *file, void *priv, | |||
1322 | return -EINVAL; | 1322 | return -EINVAL; |
1323 | 1323 | ||
1324 | strcpy(t->name, "Tuner"); | 1324 | strcpy(t->name, "Tuner"); |
1325 | t->type = V4L2_TUNER_ANALOG_TV; | ||
1326 | 1325 | ||
1327 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); | 1326 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t); |
1328 | return 0; | 1327 | return 0; |
@@ -1352,7 +1351,9 @@ static int vidioc_g_frequency(struct file *file, void *priv, | |||
1352 | struct em28xx_fh *fh = priv; | 1351 | struct em28xx_fh *fh = priv; |
1353 | struct em28xx *dev = fh->dev; | 1352 | struct em28xx *dev = fh->dev; |
1354 | 1353 | ||
1355 | f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1354 | if (0 != f->tuner) |
1355 | return -EINVAL; | ||
1356 | |||
1356 | f->frequency = dev->ctl_freq; | 1357 | f->frequency = dev->ctl_freq; |
1357 | return 0; | 1358 | return 0; |
1358 | } | 1359 | } |
@@ -1371,13 +1372,9 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
1371 | if (0 != f->tuner) | 1372 | if (0 != f->tuner) |
1372 | return -EINVAL; | 1373 | return -EINVAL; |
1373 | 1374 | ||
1374 | if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV)) | ||
1375 | return -EINVAL; | ||
1376 | if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO)) | ||
1377 | return -EINVAL; | ||
1378 | |||
1379 | dev->ctl_freq = f->frequency; | ||
1380 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); | 1375 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f); |
1376 | v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f); | ||
1377 | dev->ctl_freq = f->frequency; | ||
1381 | 1378 | ||
1382 | return 0; | 1379 | return 0; |
1383 | } | 1380 | } |