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 > 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=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 87B45C83028 for ; Thu, 2 Sep 2021 17:12:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FC0261054 for ; Thu, 2 Sep 2021 17:12:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4FC0261054 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=itgWVBUOvY1+FQts/IF2siBqHt3U5ZAPBqy6Y8ViPA8=; b=bRO2wMrTtMWKQ0 7GGUk/zBWBYY9q2vRqmqb8d3jEqt9dDdUzN1wJLY537Q7fK+tdQePFqaWrqKkTpT4Fw/dB2oCRywE SZb2El8GkFKVIVVfmzyEu8bR6Djm7/09e+glBz3TfA1UduJLfngAyUw5JnOXX1EFVasVwVWXqbj07 0YE/HmLLaJ2//YMyQiZUo2dcGCyRQgeGmvEwf08Z0kZmshOVEv0nGoBV14My3QcmP9M4MHSBe5w2N EmVqoUfbVIluk2ikswfO7bIxagwSw0JgXQhePkAZH11YgmzgO9hF47NkCTsykakZo95nBdpAdUkbz 8wsXXI87HkXU3deaQ7mQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLqE9-00A5kF-70; Thu, 02 Sep 2021 17:10:13 +0000 Received: from mail-yb1-xb34.google.com ([2607:f8b0:4864:20::b34]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLqE5-00A5jd-Fq for linux-arm-kernel@lists.infradead.org; Thu, 02 Sep 2021 17:10:10 +0000 Received: by mail-yb1-xb34.google.com with SMTP id c6so5170097ybm.10 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=olIcppJ/vlu2c/C8SjIpX1hV3yjApARo2nuzgVPLTmHQCYniltmlH7AZoPfOmqVQDc WNB0Lqi86hHZev5XIDt9l4OjiwKh7dPbkXGHAnEClRAAEk537d0v5wf0gKa5wIT96nLj YL69Y8iAZNcAeyCg5jCrvvNW3ysplsDfzHBATu6Ary5MOb/m/6W/HlH9cp5RJDA+h9Vu I+RJjS7dSDWiMl9rsHYX/IBNQclDUyVaodwWHr632wKFIm2ApWcbdM824OTsoFRusTL2 3txGgzAoPITiN08WP9rdeIKNv2kBqTj0TsSJu2kNlmyIIZXeH1mmIp+IeEOEugNk7EJB LGGg== X-Gm-Message-State: AOAM532JRG07K/4vbHGbeIkH1JYbwfTQZjcvVyXjPNJZ5rIw/5m2kNU2 bNi453i+WtWXPhNpCUuBMX8xukGg7YCZF87jIlK9hg== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210902_101009_592118_594DFA10 X-CRM114-Status: GOOD ( 25.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel