Skip to content

Commit 20deebf

Browse files
Hans VerkuilMauro Carvalho Chehab
authored andcommitted
[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>
1 parent 319a55f commit 20deebf

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎drivers/media/usb/em28xx/em28xx-video.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,6 @@ static int vidioc_g_tuner(struct file *file, void *priv,
13221322
return -EINVAL;
13231323

13241324
strcpy(t->name, "Tuner");
1325-
t->type = V4L2_TUNER_ANALOG_TV;
13261325

13271326
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
13281327
return 0;
@@ -1352,7 +1351,9 @@ static int vidioc_g_frequency(struct file *file, void *priv,
13521351
struct em28xx_fh *fh = priv;
13531352
struct em28xx *dev = fh->dev;
13541353

1355-
f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
1354+
if (0 != f->tuner)
1355+
return -EINVAL;
1356+
13561357
f->frequency = dev->ctl_freq;
13571358
return 0;
13581359
}
@@ -1371,13 +1372,9 @@ static int vidioc_s_frequency(struct file *file, void *priv,
13711372
if (0 != f->tuner)
13721373
return -EINVAL;
13731374

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;
13801375
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;
13811378

13821379
return 0;
13831380
}

0 commit comments

Comments
 (0)