]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/media/video/ivtv/ivtv-streams.c
V4L/DVB (10135): v4l2: introduce v4l2_file_operations.
[mirror_ubuntu-artful-kernel.git] / drivers / media / video / ivtv / ivtv-streams.c
index 9b7aa79eb2677d49ddd3da33c1f95fc2f6429283..854a950af78c757ae95ff9f8a39a6a7a6f1d3ede 100644 (file)
 #include "ivtv-cards.h"
 #include "ivtv-streams.h"
 
-static const struct file_operations ivtv_v4l2_enc_fops = {
+static const struct v4l2_file_operations ivtv_v4l2_enc_fops = {
        .owner = THIS_MODULE,
        .read = ivtv_v4l2_read,
        .write = ivtv_v4l2_write,
        .open = ivtv_v4l2_open,
        .unlocked_ioctl = ivtv_v4l2_ioctl,
-       .compat_ioctl = v4l_compat_ioctl32,
        .release = ivtv_v4l2_close,
        .poll = ivtv_v4l2_enc_poll,
 };
 
-static const struct file_operations ivtv_v4l2_dec_fops = {
+static const struct v4l2_file_operations ivtv_v4l2_dec_fops = {
        .owner = THIS_MODULE,
        .read = ivtv_v4l2_read,
        .write = ivtv_v4l2_write,
        .open = ivtv_v4l2_open,
        .unlocked_ioctl = ivtv_v4l2_ioctl,
-       .compat_ioctl = v4l_compat_ioctl32,
        .release = ivtv_v4l2_close,
        .poll = ivtv_v4l2_dec_poll,
 };
@@ -78,7 +76,7 @@ static struct {
        int num_offset;
        int dma, pio;
        enum v4l2_buf_type buf_type;
-       const struct file_operations *fops;
+       const struct v4l2_file_operations *fops;
 } ivtv_stream_info[] = {
        {       /* IVTV_ENC_STREAM_TYPE_MPG */
                "encoder MPG",
@@ -172,7 +170,7 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
 {
        struct ivtv_stream *s = &itv->streams[type];
        int num_offset = ivtv_stream_info[type].num_offset;
-       int num = itv->num + ivtv_first_minor + num_offset;
+       int num = itv->instance + ivtv_first_minor + num_offset;
 
        /* These four fields are always initialized. If v4l2dev == NULL, then
           this stream is not in use. In that case no other fields but these
@@ -205,11 +203,11 @@ static int ivtv_prep_dev(struct ivtv *itv, int type)
                return -ENOMEM;
        }
 
-       snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "ivtv%d %s",
-                       itv->num, s->name);
+       snprintf(s->v4l2dev->name, sizeof(s->v4l2dev->name), "%s %s",
+                       itv->device.name, s->name);
 
        s->v4l2dev->num = num;
-       s->v4l2dev->parent = &itv->dev->dev;
+       s->v4l2dev->v4l2_dev = &itv->device;
        s->v4l2dev->fops = ivtv_stream_info[type].fops;
        s->v4l2dev->release = video_device_release;
        s->v4l2dev->tvnorms = V4L2_STD_ALL;
@@ -260,6 +258,7 @@ static int ivtv_reg_dev(struct ivtv *itv, int type)
                if (s_mpg->v4l2dev)
                        num = s_mpg->v4l2dev->num + ivtv_stream_info[type].num_offset;
        }
+       video_set_drvdata(s->v4l2dev, s);
 
        /* Register device. First try the desired minor, then any free one. */
        if (video_register_device(s->v4l2dev, vfl_type, num)) {
@@ -343,7 +342,7 @@ static void ivtv_vbi_setup(struct ivtv *itv)
        ivtv_vapi(itv, CX2341X_ENC_SET_VBI_LINE, 5, 0xffff , 0, 0, 0, 0);
 
        /* setup VBI registers */
-       itv->video_dec_func(itv, VIDIOC_S_FMT, &itv->vbi.in);
+       v4l2_subdev_call(itv->sd_video, video, s_fmt, &itv->vbi.in);
 
        /* determine number of lines and total number of VBI bytes.
           A raw line takes 1443 bytes: 2 * 720 + 4 byte frame header - 1
@@ -577,10 +576,10 @@ int ivtv_start_v4l2_encode_stream(struct ivtv_stream *s)
                clear_bit(IVTV_F_I_EOS, &itv->i_flags);
 
                /* Initialize Digitizer for Capture */
-               itv->video_dec_func(itv, VIDIOC_STREAMOFF, NULL);
+               v4l2_subdev_call(itv->sd_video, video, s_stream, 0);
                ivtv_msleep_timeout(300, 1);
                ivtv_vapi(itv, CX2341X_ENC_INITIALIZE_INPUT, 0);
-               itv->video_dec_func(itv, VIDIOC_STREAMON, NULL);
+               v4l2_subdev_call(itv->sd_video, video, s_stream, 1);
        }
 
        /* begin_capture */