Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1734400rdb; Mon, 9 Oct 2023 00:32:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHy9qE+Ygj2IPt1/mqsr3KdcZmeULVzluDwHR+0kL3VXBuDbSu/wst6YCqfnsatcdVN2lb8 X-Received: by 2002:a17:90b:33cc:b0:277:4497:f0c2 with SMTP id lk12-20020a17090b33cc00b002774497f0c2mr13173843pjb.39.1696836770669; Mon, 09 Oct 2023 00:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696836770; cv=none; d=google.com; s=arc-20160816; b=Valvr9uCNr2LUwYaKs8fo0F/p91zBR71A0NjiwEEGDlQ3mRWMC8ezfvPctLLBtQ7rN skBa4JXypzV5dn/Uch6xEG686W4k8X3uluuiYJkgTsrJeAzZU+S7PYvMnkGiSaLhFpdv tJnlqXDLb9ROSPiDcKDRLYoCDqVroOzoPk52t/IwIX6Sh+sD8GnGwmzgXuSFY2ybmGyz qorZmAKy8DxTbFwfmFUWX2KrGoWA6BSE30DS/oo91xA1sFUrodG+nl3x56EwUURFni/E sc8wmhCjM4UwTrubXQ88unr5M2ug6mdn3pIlj9isSSFVxdUv0hgZc5h/D+OTFhS+UmXP /imQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XmjYbthDb2nP0QEJLjhYwbLSQgAcR7fmvNBNmj18vlw=; fh=ZsTauBTVbqllXktDoV6UUIEm8tk3jnCSMVQEaeBYwg0=; b=XTszhgfNRnF+fOSkkN5OWIxZVr8ZE8HdG7+tCDpiUm56MfF1TbXgGKNzNHzjkqThSK GnIxQLMZV363UdAMxMfva9xdKN4QLePy8Xo5jaSE1gbxTz2DBaLWMWgCZk7rv4/q2Hw9 ONsTqIbf4MPEOmMEM9WWrCBE+DLCHbkGz7szPjzbmoLa/gHKSFR0vhNKBx7+Ekl5zl+R Tyh3zN1+tPXq7ZM0gZFOoUCayAB5CeWo5nMgz4JHVsIkWBkrav4yI7Z5I3sIeTV2BvP9 ZF34/5zDtgnDcneQQ+uF6dr7vkWTAE+/gAObLTYvpwatSG+sXdftXQUDh4n3rYNGcTnQ W24Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=tlKa28v7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id bo20-20020a17090b091400b00273f1cd73b2si9120296pjb.75.2023.10.09.00.32.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 00:32:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=tlKa28v7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A3840802B664; Mon, 9 Oct 2023 00:32:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345409AbjJIHci (ORCPT + 99 others); Mon, 9 Oct 2023 03:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345374AbjJIHch (ORCPT ); Mon, 9 Oct 2023 03:32:37 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF67E8F; Mon, 9 Oct 2023 00:32:34 -0700 (PDT) Received: from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it [93.61.96.190]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 83DAC7E4; Mon, 9 Oct 2023 09:32:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1696836751; bh=3QK4iSojWRUpmqVExn0tXJeVZEiI3looQsXR+PrQlLY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tlKa28v7z6OEv7n8r6ksdbPCv6oMqJPKgM6vPAbl70l0oiX3GwbHxOfFGls+kNCmx DlOrAqqVoDfkAXl+qqrbuA2yH+JUwSnpEmCq76AJssFOz2bOh/8FUAvzrA0GGcJNgA +wXcHmD8dlefbCwgDACzsC+JCYUfJQvaZAXybX94= Date: Mon, 9 Oct 2023 09:32:28 +0200 From: Jacopo Mondi To: =?utf-8?Q?Ond=C5=99ej?= Jirman Cc: linux-rockchip@lists.infradead.org, Sakari Ailus , Jacopo Mondi , Nicholas Roth , Mauro Carvalho Chehab , "open list:V4L2 CAMERA SENSOR DRIVERS" , open list Subject: Re: [PATCH] media: i2c: ov8858: Don't set fwnode in the driver Message-ID: <3if2lurlnceoddef64qdahztus6ysyaz333x6ty3agzqqrugxo@sowcvbdf2tqe> References: <20231007130004.942369-1-megi@xff.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231007130004.942369-1-megi@xff.cz> 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 autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Mon, 09 Oct 2023 00:32:47 -0700 (PDT) X-Spam-Level: ** Hi Ondřej, On Sat, Oct 07, 2023 at 03:00:00PM +0200, Ondřej Jirman wrote: > 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 > --- > drivers/media/i2c/ov8858.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/i2c/ov8858.c b/drivers/media/i2c/ov8858.c > index 3af6125a2eee..b862dc9604cc 100644 > --- a/drivers/media/i2c/ov8858.c > +++ b/drivers/media/i2c/ov8858.c > @@ -1868,7 +1868,7 @@ static int ov8858_parse_of(struct ov8858 *ov8858) > return -EINVAL; > } > > - ov8858->subdev.fwnode = endpoint; > + fwnode_handle_put(endpoint); ov8858_parse_of() could be further simplified with: --- 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; } Do you think it's worth doing so ? > > return 0; > } > @@ -1913,7 +1913,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 +1964,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 +1976,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)) The rest looks good! Thanks j > -- > 2.42.0 >