[media] ivtv: don't allow g/s_frequency for output device nodes
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 1 Oct 2012 09:45:36 +0000 (06:45 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 1 Oct 2012 20:22:14 +0000 (17:22 -0300)
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/ivtv/ivtv-driver.c
drivers/media/pci/ivtv/ivtv-ioctl.c

index eed95a396665ce374ef11f22d324d0353b6b8a04..74e9a503236432b8c606ebfed56e87bca1fca10d 100644 (file)
@@ -1325,6 +1325,7 @@ int ivtv_init_on_first_open(struct ivtv *itv)
        int video_input;
 
        fh.itv = itv;
+       fh.type = IVTV_ENC_STREAM_TYPE_MPG;
 
        if (test_bit(IVTV_F_I_FAILED, &itv->i_flags))
                return -ENXIO;
index e5ce970266f33217cdf0b43fde09940b73b045f1..5537c88420752fced6cfb2ae70bc2262d9b7f67c 100644 (file)
@@ -1064,7 +1064,10 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp)
 static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
 {
        struct ivtv *itv = fh2id(fh)->itv;
+       struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
 
+       if (s->vdev->vfl_dir)
+               return -ENOTTY;
        if (vf->tuner != 0)
                return -EINVAL;
 
@@ -1075,7 +1078,10 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency *
 int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
 {
        struct ivtv *itv = fh2id(fh)->itv;
+       struct ivtv_stream *s = &itv->streams[fh2id(fh)->type];
 
+       if (s->vdev->vfl_dir)
+               return -ENOTTY;
        if (vf->tuner != 0)
                return -EINVAL;