Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1784488pxb; Wed, 2 Feb 2022 12:25:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJz0TyViT61j9V4JV01jZcUo8YYv7kmo3qFyPtWYMurh5ipo/hLto2FmiJ1Y6fTZC7wJ6WXO X-Received: by 2002:a17:902:b705:: with SMTP id d5mr3929277pls.120.1643833548502; Wed, 02 Feb 2022 12:25:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643833548; cv=none; d=google.com; s=arc-20160816; b=mDF0fIZ/7mEDlrKXs2aqVE/AG3QUMytjIOfe67yUaqfJHI2iXqj7H+PBv9WEcasJvN pzIFmO9wCpWnrF6pFZ2U9l/vE7iuDvnNBeCEs62LE9Bt+cDBYQa69jV4YhiccgeE+K69 LsEULm2k9+wqcfTgy/bXa4lFadJJS5hiC78hElI87CXstJ2NOBCfJHTPb/0QlV0qtZGh bT+C+NEpgJfP1eA7R16RzGZqyaxskinVJtk7RoOYSDVNv5rSjyM6g3hqQ8ut9Ort20zt Icd4LTn++0dqNJraQir+hIXdfa7NqdxIJhKLJLhcsOqaMHrXNjnwZ/957VpB82cU0/Vh lesw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q1rvwgYp5PgMyg4WO4ZT7WOYYi4vC3fkfcftrkaR1jw=; b=VyBrz+LZNpoqsECbaa53Lfz7xoKJFlNnGY4I0OZF2EdJsDPXt2U/5x+eAG8fVPCnNC gtpg94LMsKg/ASUMHyyoEW03CqXqLH0L3CJGKX+txCLQeSigp91bt+ukdtCazllSTCzL NjhF/oBnMq70Kg/8cJz6Q5ccWTbr9m8/51t176bLK0V2fshu2TjuAVHP+CcU7bSgL6hz doVOpsDhqAluQFvTBi4PwNSf1VMa4v/bWHr3767zNJMmzvcgabz1s2u/4fHYlv6hQCQ2 VnoftU23Tzo3K5F7gh2io8YOBTYi6R8grVgI5qYFFqcnwdr9lOzTxh3mCl6EMsL33ONl lWYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=t5nMt03E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l9si22482850pfc.282.2022.02.02.12.25.34; Wed, 02 Feb 2022 12:25:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=t5nMt03E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346529AbiBBR5f (ORCPT + 99 others); Wed, 2 Feb 2022 12:57:35 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:58272 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346464AbiBBR5W (ORCPT ); Wed, 2 Feb 2022 12:57:22 -0500 Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:7139:eada:2ff6:73dd]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 879EB1544; Wed, 2 Feb 2022 18:56:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1643824612; bh=7P8zmIp04YDN3+i1i3KJjkUj+aOMuxjdMxXla3XMhQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5nMt03E8apAlzwBMdK1cl5enBgQsOqWsGtEsVstIJiP41jzWbK+5Mi3LEk2arAkm OOFDvY9Y6R2KWw6iSIkAkMcejD0JI3aa56icqKnzdz1QgKbawfn1wC4PBwpegos//F m+LnC8ocLxrOvEOR7KE7WXawufNtjtp7NF7zG4AU= From: Jean-Michel Hautbois To: jeanmichel.hautbois@ideasonboard.com Cc: dave.stevenson@raspberrypi.com, devicetree@vger.kernel.org, kernel-list@raspberrypi.com, laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, lukasz@jany.st, mchehab@kernel.org, naush@raspberrypi.com, robh@kernel.org, tomi.valkeinen@ideasonboard.com Subject: [RFC PATCH v3 09/11] media: imx219: use a local v4l2_subdev to simplify reading Date: Wed, 2 Feb 2022 18:56:37 +0100 Message-Id: <20220202175639.149681-10-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> References: <20220202175639.149681-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org There is no need to dereference the imx219 structure. Use a local v4l2_subdev instead. Signed-off-by: Jean-Michel Hautbois --- drivers/media/i2c/imx219.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 7d29cf2b06f8..7c224d007f3e 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1492,6 +1492,7 @@ static int imx219_check_hwcfg(struct device *dev) static int imx219_probe(struct i2c_client *client) { struct device *dev = &client->dev; + struct v4l2_subdev *sd; struct imx219 *imx219; int ret; @@ -1499,7 +1500,8 @@ static int imx219_probe(struct i2c_client *client) if (!imx219) return -ENOMEM; - v4l2_i2c_subdev_init(&imx219->sd, client, &imx219_subdev_ops); + sd = &imx219->sd; + v4l2_i2c_subdev_init(sd, client, &imx219_subdev_ops); /* Check the hardware configuration in device tree */ if (imx219_check_hwcfg(dev)) @@ -1566,21 +1568,21 @@ static int imx219_probe(struct i2c_client *client) goto error_power_off; /* Initialize subdev */ - imx219->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | - V4L2_SUBDEV_FL_HAS_EVENTS | - V4L2_SUBDEV_FL_MULTIPLEXED; - imx219->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; + sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | + V4L2_SUBDEV_FL_HAS_EVENTS | + V4L2_SUBDEV_FL_MULTIPLEXED; + sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; /* Initialize source pad */ imx219->pad.flags = MEDIA_PAD_FL_SOURCE; - ret = media_entity_pads_init(&imx219->sd.entity, 1, &imx219->pad); + ret = media_entity_pads_init(&sd->entity, 1, &imx219->pad); if (ret) { dev_err(dev, "failed to init entity pads: %d\n", ret); goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor(&imx219->sd); + ret = v4l2_async_register_subdev_sensor(sd); if (ret < 0) { dev_err(dev, "failed to register sensor sub-device: %d\n", ret); goto error_media_entity; @@ -1594,7 +1596,7 @@ static int imx219_probe(struct i2c_client *client) return 0; error_media_entity: - media_entity_cleanup(&imx219->sd.entity); + media_entity_cleanup(&sd->entity); error_handler_free: imx219_free_controls(imx219); -- 2.32.0