From patchwork Thu Apr 18 21:35:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2462611 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 8E4CC3FE81 for ; Thu, 18 Apr 2013 21:36:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966799Ab3DRVgZ (ORCPT ); Thu, 18 Apr 2013 17:36:25 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:54985 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936487Ab3DRVf7 (ORCPT ); Thu, 18 Apr 2013 17:35:59 -0400 Received: from axis700.grange (dslb-088-077-162-170.pools.arcor-ip.net [88.77.162.170]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0M3B8p-1UmWoU1FN1-00sxXX; Thu, 18 Apr 2013 23:35:57 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 9395040BCF; Thu, 18 Apr 2013 23:35:55 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1USwUl-0005e4-7s; Thu, 18 Apr 2013 23:35:55 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Guennadi Liakhovetski Subject: [PATCH 20/24] V4L2: add a subdev pointer to struct v4l2_subdev_fh Date: Thu, 18 Apr 2013 23:35:41 +0200 Message-Id: <1366320945-21591-21-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> References: <1366320945-21591-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:g/WCaH7Kgp0Xz671MTwcJiful26GKyAwAUjSPNN/O3s zjsUp8fSnglwkKrM7eT2NC2j0bYjR8SAIvviYAl0nw4aX3wfqf jT2a4JtiYmblnrIoE2uDO+GLk0l2QDxNYNmKXdsVgIJOYGNIle DrItBei+of32m+LRZvzDus1gw2z5h6J2Dz3WYjkuOcemY8dnkI MkbuhCWRNdZn6UPGSEhSyLUPVQcB+xBOr6iOtYmD59WSNz4f9U TcCmxOlzvdiTNM6mQREfeDEax9CrY8iTF6Fb5JfGATWmSrQphH Af7P/Xfrhcq/3BW5n6m3C1c5AHnFiYetXA6UyaPUHQZ5mi8APv lAelF2/uQeWC4Gcel6jKSjWOu4CQXaQjAAxSxLCc9mI7GIS2Ps HzkMPgQqZh0jIfWDHyQyUsZrWMdSROSK/U= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is useful for cases, when there's no video-device associated with a V4L2 file-handle, e.g. in case of a dummy file-handle. Signed-off-by: Guennadi Liakhovetski --- drivers/media/v4l2-core/v4l2-subdev.c | 1 + include/media/v4l2-subdev.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 996c248..ec9f0d8 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -34,6 +34,7 @@ static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd) { + fh->subdev = sd; #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) fh->pad = kzalloc(sizeof(*fh->pad) * sd->entity.num_pads, GFP_KERNEL); if (fh->pad == NULL) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 4424a7c..0581781 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -626,6 +626,7 @@ struct v4l2_subdev_try_buf { struct v4l2_subdev_fh { struct v4l2_fh vfh; + struct v4l2_subdev *subdev; #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) struct v4l2_subdev_try_buf *pad; #endif @@ -640,8 +641,7 @@ struct v4l2_subdev_fh { v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ unsigned int pad) \ { \ - BUG_ON(pad >= vdev_to_v4l2_subdev( \ - fh->vfh.vdev)->entity.num_pads); \ + BUG_ON(pad >= fh->subdev->entity.num_pads); \ return &fh->pad[pad].field_name; \ }