Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp2544783rdb; Mon, 5 Feb 2024 09:39:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCE8/XlUrmGe3sem/H3/9R2YmNiKCwUz1B/ZiGLcdF171WGucQK2mvZkWhsRxffAQUVQDi X-Received: by 2002:a05:6808:2e93:b0:3be:b9c1:aab6 with SMTP id gt19-20020a0568082e9300b003beb9c1aab6mr495619oib.57.1707154766911; Mon, 05 Feb 2024 09:39:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707154766; cv=pass; d=google.com; s=arc-20160816; b=t5QPi3bHKCmBF6XPLPiGloAIcd8FHiYPn2KKbdTsU/xVGVDJSNvpq4uwSXTfCnN0zv efuHH5UNfV7gTQ4hcvTqS+d0UlrlYG+G+BS2y6xveJ55a0ZA27txq4ybLOIgWlT6rbBu ssYZI7U8KuwnI97cN9tK/YF92+im43KFx/Majcmtndpfpz3D5uSJ7CniQDh3bkGIfNi0 mQiSEgGth1FOKvdQbTNgj9bNy8pSYA3r+Gj6yujMNdoo8XgwDErZ2nH7sux/Fnf9g8nP zVYZ3EX6xzMBof1TyGzw7/3NeLPIh1NKMf9+4Zi8EXCzctFMocfpoUjV44FVy+ptH1ke p4bg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=vuG9WXVxv5otXHmt688D5P7h1Ojb5JaWvhbD/zOK714=; fh=tkGzs66x+z/pa7aYh6H8545s0q091Efv2qpx+3A7kl4=; b=W1Yin4dJEojwqldcljIU5ed938nVPkyJEt/LTJv+J8c5A9z7RDDS+geNIb2c+LrdzG GcJPtMv6uv8yf+e4pIHA6W4i+j8zfOYL2JrLcV4vT92DGnPJiXouDpNFG2yCoRVDkCiD 990gePJ4k48Tu2csRen1ugfBsI2R8Oz31oO396zryZWSHBDwn5cx2hxTH+K3SLbwb0Ay KGiQ4x0OGJB2OHqxKC07Kc4+DgHsc5fYWXkfY/euo2gu9sjl4j8lolr6FltCPgKxhnkg HEcE4H4PuL3mhhgwBQGqOS5nBPN1P33d4T0RkapetjNd3FJCjm/MRMf8sxbYw38tUr31 dzlw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TLpQhohu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53130-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53130-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCUqTWNTrcxXq2AuJjHQT/TSeuCMEUvPM35kCLvXSyWGRkAW2Y/ljJtGQi46cPFHzX9YeN23Z5E78alCYJsU28Y0P7MUycN8QjrGusgdUA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n8-20020a05622a040800b0042bf4b5caf6si287987qtx.480.2024.02.05.09.39.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 09:39:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-53130-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TLpQhohu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-53130-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-53130-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A45201C222D6 for ; Mon, 5 Feb 2024 17:39:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7903845036; Mon, 5 Feb 2024 17:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TLpQhohu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9505044C86; Mon, 5 Feb 2024 17:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707154590; cv=none; b=nTdF61Ry5P9dasTcpNNOu1phSlNlrF78o1V2nmSlR8asQxpfZcF5or2cLtIiNK0XqecE6rw2vODsHgR5+P/SHM/e8hnJR1m9c5z76vkYnE3VGPehw6V3OTtDHOfJpFnNZsleQssk1iX0u4Zbw0r+KmZGKvL8cx6ZwUl6239xQXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707154590; c=relaxed/simple; bh=oug84/jAh2q4sTWNbFpcEEy9Xv7ih9u0DpiD3rJtKas=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=H0SWdxuiCxCjjmH09sZj32anNm3wyaxjxEN7vfcpZPf/2p1a/5CaTghQ3Ya+DZBCIQQlAK3I7vypKn+rlUz9AgNsefyfsqtSXiCuER0AH5EwK+IlYWtldCS03Udq6wFl90Fh5fBgGn7oxZ0P+x/0tc5tPeILQk4T2c4lad1WFIg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TLpQhohu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF56AC433F1; Mon, 5 Feb 2024 17:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707154590; bh=oug84/jAh2q4sTWNbFpcEEy9Xv7ih9u0DpiD3rJtKas=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TLpQhohu2fCSUvObkfP17e/wahSiCKaz20Q+MpYXn5UisvzkvHLmBnA/55waBi11k HWXg1Wvc1S2jBz6Tew0FsL5oiZD8GqzBw48UNkBZITLZSLcsGi0PWfK2iC50VYETfz z0wxHvbb7Zi89mTEys4JmQpcapbP32OOrDw5E6+awYS/76LIiBgm/jJISoi+FpVz62 C+lQ1FwsPVoyTsoV7fiJisHfgfSDf2CBr4yCvLiwCanzABP0ctsZjmMbHGCKgjOkrx mWEgJaUpw0uw+0bhsUUYhCA/zAPKk/N0Vqe5kmWXwYiTg5ROXI/vPuuQ/rWv2Gqay7 CZGd67xbnEUtQ== Date: Mon, 5 Feb 2024 17:36:26 +0000 From: Rob Herring To: Saravana Kannan Cc: Frank Rowand , Greg Kroah-Hartman , kernel-team@android.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v1 1/2] of: property: Improve finding the consumer of a remote-endpoint property Message-ID: <20240205173626.GA3657127-robh@kernel.org> References: <20240202101326.876070-1-saravanak@google.com> <20240202101326.876070-2-saravanak@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240202101326.876070-2-saravanak@google.com> On Fri, Feb 02, 2024 at 02:13:24AM -0800, Saravana Kannan wrote: > We have a more accurate function to find the right consumer of a > remote-endpoint property instead of searching for a parent with > compatible string property. So, use that instead. While at it, make the > code to find the consumer a bit more flexible and based on the property > being parsed. > > Fixes: f7514a663016 ("of: property: fw_devlink: Add support for remote-endpoint") > Signed-off-by: Saravana Kannan > --- > drivers/of/property.c | 52 +++++++++++++------------------------------ > 1 file changed, 15 insertions(+), 37 deletions(-) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index 641a40cf5cf3..ba374a1f2072 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -1063,36 +1063,6 @@ of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, > return of_device_get_match_data(dev); > } > > -static struct device_node *of_get_compat_node(struct device_node *np) > -{ > - of_node_get(np); > - > - while (np) { > - if (!of_device_is_available(np)) { > - of_node_put(np); > - np = NULL; > - } > - > - if (of_property_present(np, "compatible")) > - break; > - > - np = of_get_next_parent(np); > - } > - > - return np; > -} > - > -static struct device_node *of_get_compat_node_parent(struct device_node *np) > -{ > - struct device_node *parent, *node; > - > - parent = of_get_parent(np); > - node = of_get_compat_node(parent); > - of_node_put(parent); > - > - return node; > -} > - > static void of_link_to_phandle(struct device_node *con_np, > struct device_node *sup_np) > { > @@ -1222,10 +1192,10 @@ static struct device_node *parse_##fname(struct device_node *np, \ > * parse_prop.prop_name: Name of property holding a phandle value > * parse_prop.index: For properties holding a list of phandles, this is the > * index into the list > + * @get_con_dev: If the consumer node containing the property is never converted > + * to a struct device, implement this ops so fw_devlink can use it > + * to find the true consumer. > * @optional: Describes whether a supplier is mandatory or not > - * @node_not_dev: The consumer node containing the property is never converted > - * to a struct device. Instead, parse ancestor nodes for the > - * compatible property to find a node corresponding to a device. > * > * Returns: > * parse_prop() return values are > @@ -1236,8 +1206,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ > struct supplier_bindings { > struct device_node *(*parse_prop)(struct device_node *np, > const char *prop_name, int index); > + struct device_node *(*get_con_dev)(struct device_node *np); > bool optional; > - bool node_not_dev; > }; > > DEFINE_SIMPLE_PROP(clocks, "clocks", "#clock-cells") > @@ -1328,6 +1298,11 @@ static struct device_node *parse_interrupts(struct device_node *np, > return of_irq_parse_one(np, index, &sup_args) ? NULL : sup_args.np; > } > > +static struct device_node *get_remote_endpoint_dev(struct device_node *np) > +{ > + return to_of_node(fwnode_graph_get_port_parent(of_fwnode_handle(np))); DT APIs shouldn't depend on fwnode APIs. Otherwise, this series looks good.