From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDF40C43214 for ; Wed, 1 Sep 2021 21:27:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C607F600CC for ; Wed, 1 Sep 2021 21:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244015AbhIAV2Q (ORCPT ); Wed, 1 Sep 2021 17:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232500AbhIAV2O (ORCPT ); Wed, 1 Sep 2021 17:28:14 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4DFC061575 for ; Wed, 1 Sep 2021 14:27:16 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id t19so1885309lfe.13 for ; Wed, 01 Sep 2021 14:27:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kp1zZ8oUcZ6p8ZISnr0CfDT7SbmamrRkIp/MXGOiwqw=; b=uPkzSwtV0JCTtIeTfxOsy6gZjHoRBQvkjnf01PQsw4jqyCf5LwtG+3iHWbW6KEH2Yv WYFmanWj8ia18DAfha3fhlfSt7hvhLwNjW0re/0++RVDYgKp+UCJnFiwnYWpdm0vIz9o JGd14R96vucstjy663XgvEB7+goauNT++cuAmUlMQKnqsVVQdhpd7ZG+zo75FCEEozDg n+fvHpWHGvncvrrMAdawqgVr+z7PojFv5Wa7gllRnO/r7mMqX5Lav/GvmhnyqIZxd+e0 4bpneRcGtzw/k8Imht0YP5gcB6JpjVXl3UzzbtF8IAgZhIfpW8Rr9bsqfOdKYPy/w8hP tGNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kp1zZ8oUcZ6p8ZISnr0CfDT7SbmamrRkIp/MXGOiwqw=; b=mp5r3Hw7IeZqpbyYdE1wZNvIT7qLtKArhmExuRuxk3dSKmfEQVkLfFoZU5G2MCCLRO Lf0Tp9alpTWA6Fcn2Ot8MjtVPcseWs03JY2c/qH+941y9tvosEPmPmAXrEg/n5+JgllZ 0B7VJ/A+FZvp8SCAMgaPKBtVO26MfcGDttsWr6uWN4x5NsU0eBWckuk37zRQkFZ8yPYD 4pzFrnh9M2QB2IL7+Wpe/9NR7tNMvFimqnXm5y1HQsS2i/2pKLuBiM3EQS4l8/By7QVR S5GCqH9bVTyul9LHDaNIjRY+c98NzjDH3j5hoKC9S9A8IoANruqayhJJ6OUKGtVytbCw cBQg== X-Gm-Message-State: AOAM5309LaB1WSyTpCASY/VbQc56f3gbJC+fa8BYuR0YUfLUknVJ6JaR RK5xgdTsFxjCr7fGSJx6M+FgiuLt4z9q8x9zUkri+Q== X-Google-Smtp-Source: ABdhPJw6FqjnM+BwCpR6avDzqjqcq19MYWghw6oY0nCvx9HKhKNeaYI5uAgum8g7fztPINA/pBN5yZWa2g8lPJugFHI= X-Received: by 2002:a19:c107:: with SMTP id r7mr1096127lff.29.1630531635257; Wed, 01 Sep 2021 14:27:15 -0700 (PDT) MIME-Version: 1.0 References: <20210831102125.624661-1-ulf.hansson@linaro.org> In-Reply-To: From: Ulf Hansson Date: Wed, 1 Sep 2021 23:26:38 +0200 Message-ID: Subject: Re: [PATCH 1/2] of: property: fw_devlink: Rename 'node_not_dev' to 'optional_con_dev' To: Saravana Kannan Cc: Rob Herring , DTML , "Rafael J . Wysocki" , Stephen Boyd , Dmitry Osipenko , Linux PM , Linux Kernel Mailing List , Linux ARM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 1 Sept 2021 at 22:56, Saravana Kannan wrote: > > On Wed, Sep 1, 2021 at 12:45 AM Ulf Hansson wrote: > > > > On Tue, 31 Aug 2021 at 19:31, Saravana Kannan wrote: > > > > > > On Tue, Aug 31, 2021 at 3:21 AM Ulf Hansson wrote: > > > > > > > > In the struct supplier_bindings the member 'node_not_dev' is described as > > > > "The consumer node containing the property is never a device.", but that > > > > doesn't match the behaviour of the code in of_link_property(). > > > > > > > > To make the behaviour consistent with the description, let's rename the > > > > member to "optional_con_dev" and clarify the corresponding comment. > > > > > > > > Signed-off-by: Ulf Hansson > > > > --- > > > > drivers/of/property.c | 9 +++++---- > > > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > > > index 6c028632f425..2babb1807228 100644 > > > > --- a/drivers/of/property.c > > > > +++ b/drivers/of/property.c > > > > @@ -1249,7 +1249,8 @@ static struct device_node *parse_##fname(struct device_node *np, \ > > > > * @parse_prop.index: For properties holding a list of phandles, this is the > > > > * index into the list > > > > * @optional: Describes whether a supplier is mandatory or not > > > > - * @node_not_dev: The consumer node containing the property is never a device. > > > > + * @optional_con_dev: The consumer node containing the property may not be a > > > > + * device, then try finding one from an ancestor node. > > > > > > Nak. This flag is not about "may not be". This is explicitly for > > > "never a device". It has to do with stuff like remote-endpoint which > > > is never listed under the root node of the device node. Your > > > documentation change is changing the meaning of the flag. > > > > Okay, fair enough. > > > > Although, as stated in the commit message this isn't the way code > > behaves. Shouldn't we at least make the behaviour consistent with the > > description of the 'node_not_dev' flag? > > I know what you mean, but if you use the flag correctly (where the > phandle pointed to will never be a device with compatible property), > the existing code would work correctly. And since the flag is relevant > only in this file, it's easy to keep it correct. I'd just leave it as > is. Sorry, but that just sounds lazy to me, I am sure we can do better. The current code and the name of the flag is confusing, at least to me (and I bet to others as well). Moreover, I don't quite understand your objections to changing this. Why leave this to be inconsistent when it can be easily fixed? > > -Saravana Kind regards Uffe > > > > > > Along the lines of the below patch then? > > > > From: Ulf Hansson > > Date: Wed, 1 Sep 2021 09:28:03 +0200 > > Subject: [PATCH] of: property: fw_devlink: Fixup behaviour when 'node_not_dev' > > is set > > > > In the struct supplier_bindings the member 'node_not_dev' is described as > > "The consumer node containing the property is never a device.", but that is > > inconsistent with the behaviour of the code in of_link_property(), as it > > calls of_get_compat_node() that starts parsing for a compatible property, > > starting from the node it gets passed to it. > > > > Make the behaviour consistent with the description of the 'node_not_dev' > > flag, by passing the parent node to of_get_compat_node() instead. > > > > Signed-off-by: Ulf Hansson > > --- > > drivers/of/property.c | 13 ++++++++++++- > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/of/property.c b/drivers/of/property.c > > index 6c028632f425..16ee017884b8 100644 > > --- a/drivers/of/property.c > > +++ b/drivers/of/property.c > > @@ -1075,6 +1075,17 @@ static struct device_node > > *of_get_compat_node(struct device_node *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; > > +} > > + > > /** > > * of_link_to_phandle - Add fwnode link to supplier from supplier phandle > > * @con_np: consumer device tree node > > @@ -1416,7 +1427,7 @@ static int of_link_property(struct device_node > > *con_np, const char *prop_name) > > struct device_node *con_dev_np; > > > > con_dev_np = s->node_not_dev > > - ? of_get_compat_node(con_np) > > + ? of_get_compat_node_parent(con_np) > > : of_node_get(con_np); > > matched = true; > > i++; > > -- > > 2.25.1 > > > > [...] > > > > Kind regards > > Uffe