Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2335099rdb; Tue, 10 Oct 2023 00:08:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IElv/q+rlpfGovleqcMs6NNGXgu6IFSczsdsh7j3vbOF/q/rt44wTP0lXlfEXRPUjFw4vwL X-Received: by 2002:a05:6358:2605:b0:12b:e45b:3fac with SMTP id l5-20020a056358260500b0012be45b3facmr17331620rwc.32.1696921696471; Tue, 10 Oct 2023 00:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696921696; cv=none; d=google.com; s=arc-20160816; b=yTvMQmIP2G1vLvhRDyaci6KgU1nYuESz53rpjm4E3fU5cwPBtny8VkyrfMRdBKlBST KtqG6kiYYXyimtCrSgA6+OeThThB6weW34rndWF5eco9aaJCqhcE0uNteCsQ5Huxb3NC 0UwdpDOEKjbzx3sqXfBQJcsZs/iVFWQTGV2f0eCuQ8PHoKO4Dy+4SuJQe0Lfc6DgDgoC +4tYZrLMuQZDJROBhkgQo7x/QdDAIULP2OoZsOeF2KskxkoX914/vxdYfTXZq4JVBLda JjTSi01XBGu7yG0p3mZ+o2Qaqo17sCe4tV1sateJqwo2OKfIiLZ/yCamLWaDjed/5QKb HB5A== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=gNoWUAea96ObIJipoNDABlsh3EOiKN80P51Nz7b3dD4=; fh=T0y6kzMRBJN+GaGW3Dj2j45FLH06gocGyc76UXyhTqA=; b=LHzNH3iwPYJt04NUyEErW631Rq6E1eDQbp92vBB7Al8cAoveRyMebKeFfmibWMcNzr vVLS3GeF9eIuGgEl9zuI/IQ81FTd0njNEongMRZyHAHyfqeAemBlgjexatbJYHXWI4MW tT7wT/LNGZq+EBoSOc4UA66BWa+/O9njkWCvDtG/EIX9AniKIIIO5TguXp/DM5fsvylj 0IQwYdWV8EWYTKfzZrRxwaWJbVnQ3indHjroIA6GOkgWMwoSI0devSmKh3aALJdnx4PO hRT1Ll3zXKlm+YY9wPUhtrVsDMRvL2bjx8f5M3HZAXDYF1c7n0MBWNBDPzleb/L7t0lm vrrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=u9HA17p7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id 7-20020a17090a08c700b002680e08a877si1134346pjn.186.2023.10.10.00.08.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 00:08:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@xff.cz header.s=mail header.b=u9HA17p7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=xff.cz Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id CD29D8026B69; Tue, 10 Oct 2023 00:08:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442350AbjJJHID (ORCPT + 99 others); Tue, 10 Oct 2023 03:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377808AbjJJHIB (ORCPT ); Tue, 10 Oct 2023 03:08:01 -0400 Received: from vps.xff.cz (vps.xff.cz [195.181.215.36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10B3A92; Tue, 10 Oct 2023 00:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xff.cz; s=mail; t=1696921675; bh=4lNplERnI6yZsihONwZhR1SOQRzefzq61EbgYbT+Bl4=; h=From:To:Cc:Subject:Date:From; b=u9HA17p7oMjX7AEpQ9GGFvYeQ7rA7lsBRNbzq6/RpIbGCbQ2KQlco8lZ1vw3O/EGP b2BGQhYZEx5gRHcbg2QDf/VgPjNTUaB2+jby10JNMtqUDC5886z2UoC2MA22NHh0B8 UwURBQ4Cf8MkSqwyXU9boo2KWNtYDH/pHBm3FU9A= From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= To: linux-rockchip@lists.infradead.org Cc: Ondrej Jirman , Jacopo Mondi , Nicholas Roth , Sakari Ailus , Mauro Carvalho Chehab , linux-media@vger.kernel.org (open list:OMNIVISION OV8858 SENSOR DRIVER), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2] media: i2c: ov8858: Don't set fwnode in the driver Date: Tue, 10 Oct 2023 09:07:44 +0200 Message-ID: <20231010070747.1781612-1-megi@xff.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 10 Oct 2023 00:08:14 -0700 (PDT) X-Spam-Level: ** From: Ondrej Jirman This makes the driver work with the new check in v4l2_async_register_subdev() that was introduced recently in 6.6-rc1. Without this change, probe fails with: ov8858 1-0036: Detected OV8858 sensor, revision 0xb2 ov8858 1-0036: sub-device fwnode is an endpoint! ov8858 1-0036: v4l2 async register subdev failed ov8858: probe of 1-0036 failed with error -22 This also simplifies the driver a bit. Signed-off-by: Ondrej Jirman --- v2: - call fwnode_handle_put earlier to avoid multiple calls to it in error code paths (suggested by Jacopo Mondi) drivers/media/i2c/ov8858.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c index 3af6125a2eee..4d9fd76e2f60 100644 --- a/drivers/media/i2c/ov8858.c +++ b/drivers/media/i2c/ov8858.c @@ -1850,9 +1850,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858) } ret = v4l2_fwnode_endpoint_parse(endpoint, &vep); + fwnode_handle_put(endpoint); if (ret) { dev_err(dev, "Failed to parse endpoint: %d\n", ret); - fwnode_handle_put(endpoint); return ret; } @@ -1864,12 +1864,9 @@ static int ov8858_parse_of(struct ov8858 *ov8858) default: dev_err(dev, "Unsupported number of data lanes %u\n", ov8858->num_lanes); - fwnode_handle_put(endpoint); return -EINVAL; } - ov8858->subdev.fwnode = endpoint; - return 0; } @@ -1913,7 +1910,7 @@ static int ov8858_probe(struct i2c_client *client) ret = ov8858_init_ctrls(ov8858); if (ret) - goto err_put_fwnode; + return ret; sd = &ov8858->subdev; sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; @@ -1964,8 +1961,6 @@ static int ov8858_probe(struct i2c_client *client) media_entity_cleanup(&sd->entity); err_free_handler: v4l2_ctrl_handler_free(&ov8858->ctrl_handler); -err_put_fwnode: - fwnode_handle_put(ov8858->subdev.fwnode); return ret; } @@ -1978,7 +1973,6 @@ static void ov8858_remove(struct i2c_client *client) v4l2_async_unregister_subdev(sd); media_entity_cleanup(&sd->entity); v4l2_ctrl_handler_free(&ov8858->ctrl_handler); - fwnode_handle_put(ov8858->subdev.fwnode); pm_runtime_disable(&client->dev); if (!pm_runtime_status_suspended(&client->dev)) -- 2.42.0