From patchwork Thu Sep 20 12:06:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 1484171 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by patchwork2.kernel.org (Postfix) with ESMTP id A57ECDF2D2 for ; Thu, 20 Sep 2012 12:13:55 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id q8KCA6wh019879; Thu, 20 Sep 2012 07:10:19 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8KCA6wL016089; Thu, 20 Sep 2012 07:10:06 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Thu, 20 Sep 2012 07:10:06 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q8KCA6N2018106; Thu, 20 Sep 2012 07:10:06 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 7E1968062F; Thu, 20 Sep 2012 07:10:05 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 83A238062B for ; Thu, 20 Sep 2012 07:07:23 -0500 (CDT) Received: from neches.ext.ti.com (neches.ext.ti.com [192.91.81.29]) by dflp51.itg.ti.com (8.13.7/8.13.8) with ESMTP id q8KC7NBb000886 for ; Thu, 20 Sep 2012 07:07:23 -0500 (CDT) Received: from psmtp.com (na3sys009amx222.postini.com [74.125.149.62]) by neches.ext.ti.com (8.13.7/8.13.7) with SMTP id q8KC7Lje020137 for ; Thu, 20 Sep 2012 07:07:21 -0500 Received: from smtp-vbr13.xs4all.nl ([194.109.24.33]) by na3sys009amx222.postini.com ([74.125.148.10]) with SMTP; Thu, 20 Sep 2012 12:07:21 GMT Received: from alastor.dyndns.org (166.80-203-20.nextgentel.com [80.203.20.166] (may be forged)) (authenticated bits=0) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id q8KC6dI6004486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 20 Sep 2012 14:06:40 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from tschai.lan (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 3587435C0142; Thu, 20 Sep 2012 14:06:38 +0200 (CEST) From: Hans Verkuil To: Subject: [RFCv2 PATCH 03/14] vpif_capture: move input_idx to channel_obj. Date: Thu, 20 Sep 2012 14:06:22 +0200 Message-ID: X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <15fd87671d173ae4b943df4114aafb55d7e958fa.1348142407.git.hans.verkuil@cisco.com> References: <15fd87671d173ae4b943df4114aafb55d7e958fa.1348142407.git.hans.verkuil@cisco.com> X-Virus-Scanned: by XS4ALL Virus Scanner X-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390 R:95.9108 P:95.9108 M:97.0282 C:98.6951 ) X-pstn-dkim: 0 skipped:not-enabled X-pstn-settings: 2 (0.5000:0.5000) s cv gt3 gt2 gt1 r p m c X-pstn-addresses: from [82/3] CC: Hans Verkuil , DLOS X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Hans Verkuil 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 --- drivers/media/platform/davinci/vpif_capture.c | 9 ++------- drivers/media/platform/davinci/vpif_capture.h | 4 ++-- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/davinci/vpif_capture.c b/drivers/media/platform/davinci/vpif_capture.c index 78edd01..4233554 100644 --- a/drivers/media/platform/davinci/vpif_capture.c +++ b/drivers/media/platform/davinci/vpif_capture.c @@ -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 */ diff --git a/drivers/media/platform/davinci/vpif_capture.h b/drivers/media/platform/davinci/vpif_capture.h index 0a3904c..a284667 100644 --- a/drivers/media/platform/davinci/vpif_capture.h +++ b/drivers/media/platform/davinci/vpif_capture.h @@ -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 */