On Sun January 13 2013 13:50:50 Frank Schäfer wrote:
> Signed-off-by: Frank Schäfer <[email protected]>
> ---
> drivers/media/usb/em28xx/em28xx-video.c | 8 ++++++++
> 1 Datei geändert, 8 Zeilen hinzugefügt(+)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-video.c
> b/drivers/media/usb/em28xx/em28xx-video.c
> index 2eabf2a..4a7f73c 100644
> --- a/drivers/media/usb/em28xx/em28xx-video.c
> +++ b/drivers/media/usb/em28xx/em28xx-video.c
> @@ -1204,6 +1204,8 @@ static int vidioc_g_tuner(struct file *file, void *priv,
> struct em28xx *dev = fh->dev;
> int rc;
>
> + if (dev->tuner_type == TUNER_ABSENT)
> + return -ENOTTY;
> rc = check_dev(dev);
> if (rc < 0)
> return rc;
> @@ -1224,6 +1226,8 @@ static int vidioc_s_tuner(struct file *file, void *priv,
> struct em28xx *dev = fh->dev;
> int rc;
>
> + if (dev->tuner_type == TUNER_ABSENT)
> + return -ENOTTY;
> rc = check_dev(dev);
> if (rc < 0)
> return rc;
> @@ -1241,6 +1245,8 @@ static int vidioc_g_frequency(struct file *file, void
> *priv,
> struct em28xx_fh *fh = priv;
> struct em28xx *dev = fh->dev;
>
> + if (dev->tuner_type == TUNER_ABSENT)
> + return -ENOTTY;
> if (0 != f->tuner)
> return -EINVAL;
>
> @@ -1255,6 +1261,8 @@ static int vidioc_s_frequency(struct file *file, void
> *priv,
> struct em28xx *dev = fh->dev;
> int rc;
>
> + if (dev->tuner_type == TUNER_ABSENT)
> + return -ENOTTY;
> rc = check_dev(dev);
> if (rc < 0)
> return rc;
>
Rather than doing this in each ioctl, I recommend using v4l2_disable_ioctl
instead. See for example drivers/media/pci/ivtv/ivtv-streams.c.
Regards,
Hans
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html