[media] vpif_capture: move input_idx to channel_obj
authorHans Verkuil <hans.verkuil@cisco.com>
Thu, 20 Sep 2012 12:06:22 +0000 (09:06 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 6 Oct 2012 01:00:44 +0000 (22:00 -0300)
input_idx does not belong to video_obj. Move it where it belongs.
Also remove the bogus code in the open() function that suddenly
changes the input to 0 for no reason.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Tested-by: Lad, Prabhakar <prabhakar.lad@ti.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/platform/davinci/vpif_capture.c
drivers/media/platform/davinci/vpif_capture.h

index 8dbbd4bffb84b4908090bbf4e36b8f1be66b5a8f..834510679c6dcdfa51826bac78dbb2c6838a68a7 100644 (file)
@@ -888,8 +888,6 @@ static int vpif_open(struct file *filep)
                        if (vpif_obj.sd[i]) {
                                /* the sub device is registered */
                                ch->curr_subdev_info = &config->subdev_info[i];
-                               /* make first input as the current input */
-                               vid_ch->input_idx = 0;
                                break;
                        }
                }
@@ -1442,10 +1440,8 @@ static int vpif_g_input(struct file *file, void *priv, unsigned int *index)
 {
        struct vpif_fh *fh = priv;
        struct channel_obj *ch = fh->channel;
-       struct video_obj *vid_ch = &ch->video;
-
-       *index = vid_ch->input_idx;
 
+       *index = ch->input_idx;
        return 0;
 }
 
@@ -1462,7 +1458,6 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
        struct vpif_fh *fh = priv;
        struct channel_obj *ch = fh->channel;
        struct common_obj *common = &ch->common[VPIF_VIDEO_INDEX];
-       struct video_obj *vid_ch = &ch->video;
        struct vpif_subdev_info *subdev_info;
        int ret = 0, sd_index = 0;
        u32 input = 0, output = 0;
@@ -1517,7 +1512,7 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
                        return ret;
                }
        }
-       vid_ch->input_idx = index;
+       ch->input_idx = index;
        ch->curr_subdev_info = subdev_info;
        ch->curr_sd_index = sd_index;
        /* copy interface parameters to vpif */
index 1bc9d8bdd7561081dac6b7ee13d408a7a35832c7..760964c5687902a45cfb7ae188c282e1e324a89f 100644 (file)
@@ -54,8 +54,6 @@ struct video_obj {
        /* Currently selected or default standard */
        v4l2_std_id stdid;
        struct v4l2_dv_timings dv_timings;
-       /* This is to track the last input that is passed to application */
-       u32 input_idx;
 };
 
 struct vpif_cap_buffer {
@@ -121,6 +119,8 @@ struct channel_obj {
        enum vpif_channel_id channel_id;
        /* index into sd table */
        int curr_sd_index;
+       /* Current input */
+       u32 input_idx;
        /* ptr to current sub device information */
        struct vpif_subdev_info *curr_subdev_info;
        /* vpif configuration params */