diff mbox

[RFCv1,03/11] vpif_capture: move input_idx to channel_obj.

Message ID af16e4a7239796afde34c84449bfe66134b84ce5.1347965140.git.hans.verkuil@cisco.com (mailing list archive)
State Superseded
Headers show

Commit Message

Hans Verkuil Sept. 18, 2012, 10:53 a.m. UTC
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>
---
 drivers/media/video/davinci/vpif_capture.c |    9 ++-------
 drivers/media/video/davinci/vpif_capture.h |    4 ++--
 2 files changed, 4 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c
index 313f461..eec687c 100644
--- a/drivers/media/video/davinci/vpif_capture.c
+++ b/drivers/media/video/davinci/vpif_capture.c
@@ -880,8 +880,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;
 			}
 		}
@@ -1427,10 +1425,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;
 }
 
@@ -1447,7 +1443,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;
@@ -1502,7 +1497,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 */
diff --git a/drivers/media/video/davinci/vpif_capture.h b/drivers/media/video/davinci/vpif_capture.h
index de19c80..cf954f8 100644
--- a/drivers/media/video/davinci/vpif_capture.h
+++ b/drivers/media/video/davinci/vpif_capture.h
@@ -55,8 +55,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 {
@@ -122,6 +120,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 */