Commit c2dcef83 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: use v4l2_disable_ioctl() to disable ioctls VIDIOC_G_AUDIO and VIDIOC_S_AUDIO

Instead of checking the device type and returning -EINVAL inside the ioctl
functions, use v4l2_disable_ioctl() to disable the ioctls VIDIOC_G_AUDIO and
VIDIOC_S_AUDIO if the device doesn't support audio.
Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 66df67b7
...@@ -1130,9 +1130,6 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a) ...@@ -1130,9 +1130,6 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a)
struct em28xx_fh *fh = priv; struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
if (!dev->audio_mode.has_audio)
return -EINVAL;
switch (a->index) { switch (a->index) {
case EM28XX_AMUX_VIDEO: case EM28XX_AMUX_VIDEO:
strcpy(a->name, "Television"); strcpy(a->name, "Television");
...@@ -1173,10 +1170,6 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio ...@@ -1173,10 +1170,6 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio
struct em28xx_fh *fh = priv; struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev; struct em28xx *dev = fh->dev;
if (!dev->audio_mode.has_audio)
return -EINVAL;
if (a->index >= MAX_EM28XX_INPUT) if (a->index >= MAX_EM28XX_INPUT)
return -EINVAL; return -EINVAL;
if (0 == INPUT(a->index)->type) if (0 == INPUT(a->index)->type)
...@@ -1905,6 +1898,10 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -1905,6 +1898,10 @@ int em28xx_register_analog_devices(struct em28xx *dev)
v4l2_disable_ioctl(dev->vdev, VIDIOC_G_FREQUENCY); v4l2_disable_ioctl(dev->vdev, VIDIOC_G_FREQUENCY);
v4l2_disable_ioctl(dev->vdev, VIDIOC_S_FREQUENCY); v4l2_disable_ioctl(dev->vdev, VIDIOC_S_FREQUENCY);
} }
if (!dev->audio_mode.has_audio) {
v4l2_disable_ioctl(dev->vdev, VIDIOC_G_AUDIO);
v4l2_disable_ioctl(dev->vdev, VIDIOC_S_AUDIO);
}
/* register v4l2 video video_device */ /* register v4l2 video video_device */
ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER, ret = video_register_device(dev->vdev, VFL_TYPE_GRABBER,
...@@ -1930,6 +1927,10 @@ int em28xx_register_analog_devices(struct em28xx *dev) ...@@ -1930,6 +1927,10 @@ int em28xx_register_analog_devices(struct em28xx *dev)
v4l2_disable_ioctl(dev->vbi_dev, VIDIOC_G_FREQUENCY); v4l2_disable_ioctl(dev->vbi_dev, VIDIOC_G_FREQUENCY);
v4l2_disable_ioctl(dev->vbi_dev, VIDIOC_S_FREQUENCY); v4l2_disable_ioctl(dev->vbi_dev, VIDIOC_S_FREQUENCY);
} }
if (!dev->audio_mode.has_audio) {
v4l2_disable_ioctl(dev->vbi_dev, VIDIOC_G_AUDIO);
v4l2_disable_ioctl(dev->vbi_dev, VIDIOC_S_AUDIO);
}
/* register v4l2 vbi video_device */ /* register v4l2 vbi video_device */
ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, ret = video_register_device(dev->vbi_dev, VFL_TYPE_VBI,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment