mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
[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>
This commit is contained in:
parent
319a55fbe4
commit
20deebfe17
@ -1322,7 +1322,6 @@ static int vidioc_g_tuner(struct file *file, void *priv,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
strcpy(t->name, "Tuner");
|
strcpy(t->name, "Tuner");
|
||||||
t->type = V4L2_TUNER_ANALOG_TV;
|
|
||||||
|
|
||||||
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_tuner, t);
|
||||||
return 0;
|
return 0;
|
||||||
@ -1352,7 +1351,9 @@ static int vidioc_g_frequency(struct file *file, void *priv,
|
|||||||
struct em28xx_fh *fh = priv;
|
struct em28xx_fh *fh = priv;
|
||||||
struct em28xx *dev = fh->dev;
|
struct em28xx *dev = fh->dev;
|
||||||
|
|
||||||
f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
|
if (0 != f->tuner)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
f->frequency = dev->ctl_freq;
|
f->frequency = dev->ctl_freq;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1371,13 +1372,9 @@ static int vidioc_s_frequency(struct file *file, void *priv,
|
|||||||
if (0 != f->tuner)
|
if (0 != f->tuner)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (unlikely(0 == fh->radio && f->type != V4L2_TUNER_ANALOG_TV))
|
|
||||||
return -EINVAL;
|
|
||||||
if (unlikely(1 == fh->radio && f->type != V4L2_TUNER_RADIO))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
dev->ctl_freq = f->frequency;
|
|
||||||
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_frequency, f);
|
||||||
|
v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, g_frequency, f);
|
||||||
|
dev->ctl_freq = f->frequency;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user