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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL 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 0E437C83028 for ; Thu, 2 Sep 2021 17:10:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E616F61054 for ; Thu, 2 Sep 2021 17:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346548AbhIBRLJ (ORCPT ); Thu, 2 Sep 2021 13:11:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346501AbhIBRLH (ORCPT ); Thu, 2 Sep 2021 13:11:07 -0400 Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E5EC061757 for ; Thu, 2 Sep 2021 10:10:08 -0700 (PDT) Received: by mail-yb1-xb35.google.com with SMTP id f15so5230925ybg.3 for ; Thu, 02 Sep 2021 10:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZNnGL/XFkRACc5/CvoRAa+dSZMwb3AAvxOKNDcBdSNM=; b=hEwlT3tYR2Y31bwXVcknM/ypCL0SfikclQ4C9fMYjRR1+rQmog4PK6nRvTQKh97yoQ s7Tg5N94Vr/J02byNanGEtllbrHrSb6RualdV5dxuVcNods1HVS2TVSNMZn+8a/W14PU g2y/1Wm73RdC8yZNDuv8cTRi9RQEL1St3o6XG4uzaruoIzKA9jBGbKbGSMsfVjypo6Y1 vMPgZORq6yI29cWlIEtFRuHUXmkRh7ZfYD0UIpUvhoSFI6v6rE4mURxeN6qr6IA3ZVEY yHVLboNcPXLpTZqClnttBGFdLWekds8ZR0GDLgbvZoSZ3a9fGNTvcz2SLTjxP+gLIzTQ QCAA== 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=ZNnGL/XFkRACc5/CvoRAa+dSZMwb3AAvxOKNDcBdSNM=; b=Mgy0I0NFnEwGyul2G0XeFWC/4z1GlYjLB1TVp4nmhadTCn6uCHdSCGmhYAqAUdtYhN UL9+bqyne4r4rB3vfDLNaeReyL9JCmyzTBa+NSLmhJomkWPL8tqKJ2Wl8xKXNFu3KsR+ sttnV/wKU71A/BGfvpxxyXwE4XCaGCLhvmn9XIDi3cS1jWUCo4nwH6rSGZj1mxOAc8hT Jz5lZi7dCLQKq3Vl/XVbYZ0X4fhjBCVP4JOjtxrTbTvw//Q6l76hf5Vz21xpB3US5Yog scWYqu6vUgzYPYzV1M/eNsm/pLDodsAt24nFcG6c+Aq4DiwAcvunZuv6hBeqOQfbKVMF JJSA== X-Gm-Message-State: AOAM5331wsIqhXS9iesiV9hsaKCxf4BuO8CyxtYWNf4+KpGFC21y5Azy lS/1VoodisIeGd+H2ejlCcQ7dRvkJ4i9Zgd9EZPoxg== X-Google-Smtp-Source: ABdhPJz2YTSqz5EeiE5FHkhjNK+OPxgcJfPp1zoX7Cf/S0pbqfT5CJ+wPJareJf4D00vVRM27wfYnbzZFVmWZbdh5p0= X-Received: by 2002:a5b:50b:: with SMTP id o11mr5830667ybp.466.1630602607975; Thu, 02 Sep 2021 10:10:07 -0700 (PDT) MIME-Version: 1.0 References: <20210902090221.820254-1-ulf.hansson@linaro.org> In-Reply-To: <20210902090221.820254-1-ulf.hansson@linaro.org> From: Saravana Kannan Date: Thu, 2 Sep 2021 10:09:32 -0700 Message-ID: Subject: Re: [PATCH] of: property: fw_devlink: Fixup behaviour when 'node_not_dev' is set To: Ulf Hansson Cc: Rob Herring , devicetree@vger.kernel.org, "Rafael J . Wysocki" , Stephen Boyd , Dmitry Osipenko , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 2, 2021 at 2:02 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 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 > from the node it gets passed to it. The proper behaviour is to start at the > node's parent, so let's do that. > > While at it, let's take the opportunity to update the description of the > 'node_not_dev' flag, as to clarify its purpose. > > Signed-off-by: Ulf Hansson Reviewed-by: Saravana Kannan -Saravana > --- > drivers/of/property.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index 6c028632f425..a94d007be416 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 > @@ -1249,7 +1260,9 @@ 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. > + * @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 > @@ -1416,7 +1429,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 >