From patchwork Sat Jul 18 14:59:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11671975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80B8413A4 for ; Sat, 18 Jul 2020 14:59:46 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AA6E20656 for ; Sat, 18 Jul 2020 14:59:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SslmM/MO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AA6E20656 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=llCBGcfg0VUZCSnqZu93qIF2ugnluefWGB3nhuxwA7s=; b=SslmM/MOGoGPro8xNDVSKyhoiy uWlFtjJMp2zs3kAZ8NqG9xM4ytQkeRq71gRDT+LhzLJBcKdpLuCVLL2zglg89nKQK0Qih9XQF3nNm O/VI7D3otd7hm47cu+qiFITRs6Ea1gR/oXlcWO2caFj4LqeQGQI8TMmZR0VqVUIsONASHqKizngSI AicVDSxQV9u6MlUdpbgnZpGy+x68CpTTQyyGCArZmKJ7I4sJCjg5EDRXdUnpsL4Qrbi9D9I9byuBC iVCivDle2tjWJvteBT3Wdv7PESGqQmuGHzMJl1kBnN71yV4ZUOLoh1F7dRaHRvUrHOGYOx4K4XfpF 28tPxe2Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwoJT-0006Wb-6X; Sat, 18 Jul 2020 14:59:43 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwoJG-0006O5-GU for linux-rockchip@lists.infradead.org; Sat, 18 Jul 2020 14:59:34 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: dafna) with ESMTPSA id 715622A52C6 From: Dafna Hirschfeld To: linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH v2 5/9] media: staging: rkisp1: add a pointer to rkisp1_device from struct rkisp1_isp Date: Sat, 18 Jul 2020 16:59:14 +0200 Message-Id: <20200718145918.17752-6-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200718145918.17752-1-dafna.hirschfeld@collabora.com> References: <20200718145918.17752-1-dafna.hirschfeld@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200718_105931_338097_326D7A14 X-CRM114-Status: GOOD ( 11.31 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mchehab@kernel.org, dafna.hirschfeld@collabora.com, dafna3@gmail.com, tfiga@chromium.org, hverkuil@xs4all.nl, linux-rockchip@lists.infradead.org, helen.koike@collabora.com, sakari.ailus@linux.intel.com, kernel@collabora.com, ezequiel@collabora.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org The code in rkisp1-isp.c requires access to struct 'rkisp1_device' in several places. It access it using the 'container_of' macro. This patch adds a pointer to 'rkisp1_device' in struct 'rkisp1_isp' to simplify the access. Signed-off-by: Dafna Hirschfeld --- drivers/staging/media/rkisp1/rkisp1-common.h | 1 + drivers/staging/media/rkisp1/rkisp1-isp.c | 12 +++++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-common.h b/drivers/staging/media/rkisp1/rkisp1-common.h index e54793d13c3d..893caa9df891 100644 --- a/drivers/staging/media/rkisp1/rkisp1-common.h +++ b/drivers/staging/media/rkisp1/rkisp1-common.h @@ -106,6 +106,7 @@ struct rkisp1_sensor_async { */ struct rkisp1_isp { struct v4l2_subdev sd; + struct rkisp1_device *rkisp1; struct media_pad pads[RKISP1_ISP_PAD_MAX]; struct v4l2_subdev_pad_config pad_cfg[RKISP1_ISP_PAD_MAX]; const struct rkisp1_isp_mbus_info *sink_fmt; diff --git a/drivers/staging/media/rkisp1/rkisp1-isp.c b/drivers/staging/media/rkisp1/rkisp1-isp.c index 6ec1e9816e9f..b2131aea5488 100644 --- a/drivers/staging/media/rkisp1/rkisp1-isp.c +++ b/drivers/staging/media/rkisp1/rkisp1-isp.c @@ -836,9 +836,8 @@ static int rkisp1_isp_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) { - struct rkisp1_device *rkisp1 = - container_of(sd->v4l2_dev, struct rkisp1_device, v4l2_dev); struct rkisp1_isp *isp = container_of(sd, struct rkisp1_isp, sd); + struct rkisp1_device *rkisp1 = isp->rkisp1; int ret = 0; if (sel->target != V4L2_SEL_TGT_CROP) @@ -883,8 +882,7 @@ static const struct v4l2_subdev_pad_ops rkisp1_isp_pad_ops = { static int rkisp1_mipi_csi2_start(struct rkisp1_isp *isp, struct rkisp1_sensor_async *sensor) { - struct rkisp1_device *rkisp1 = - container_of(isp->sd.v4l2_dev, struct rkisp1_device, v4l2_dev); + struct rkisp1_device *rkisp1 = isp->rkisp1; union phy_configure_opts opts; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; s64 pixel_clock; @@ -916,9 +914,8 @@ static void rkisp1_mipi_csi2_stop(struct rkisp1_sensor_async *sensor) static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable) { - struct rkisp1_device *rkisp1 = - container_of(sd->v4l2_dev, struct rkisp1_device, v4l2_dev); - struct rkisp1_isp *isp = &rkisp1->isp; + struct rkisp1_isp *isp = container_of(sd, struct rkisp1_isp, sd); + struct rkisp1_device *rkisp1 = isp->rkisp1; struct v4l2_subdev *sensor_sd; int ret = 0; @@ -997,6 +994,7 @@ int rkisp1_isp_register(struct rkisp1_device *rkisp1, struct v4l2_subdev *sd = &isp->sd; int ret; + isp->rkisp1 = rkisp1; v4l2_subdev_init(sd, &rkisp1_isp_ops); sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; sd->entity.ops = &rkisp1_isp_media_ops;