Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1217597rdg; Fri, 11 Aug 2023 13:51:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEXKIvkR48Tg40yMFR9X3fY9A08sxGtigGE4lql0Bbx9TvlPhOYzeAL6/ZoQuV6ZS7qoRhF X-Received: by 2002:a17:907:75ee:b0:99c:c59:2283 with SMTP id jz14-20020a17090775ee00b0099c0c592283mr2433809ejc.60.1691787094979; Fri, 11 Aug 2023 13:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691787094; cv=none; d=google.com; s=arc-20160816; b=CMzXpWv+PP49Zi5pdXJCpSdfj7+YPupXxNpD9bqzfjwX9Oe8y4txRPZ0x/YRtSPjm/ qBpmTi9vF68xztWHnQFzOXFdtYkyfIndB92B1W8lSIS6UOGabHqfqSRCquSmTZLbul0V PCkRsU30LLD5/nUV4RuiRU04LLMYFdMWOdIAiFbipPOd0eDMMcr2XMfaTqORJJKljLFa Gctt2vRs8Fnv5tXWKyKBdplE8WvNE+oSciK3jTBO8tfEvCKPc8QfXEcx5HZ6aH0vur2h v+jwgRLUAz06qANp29vL0mENlFdhy3rBCcWSPcfHjv4zX2lL30Bp1uaPlKyTyF/+aBmA SVlQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9UBXZ11VDMVboVgB7B2sFFVOTVA7ayyYyUa/bkpe6so=; fh=0CsJokUpMDWB+6PjjNlRdhF/XLzbrPm8abpBfv3QW5Q=; b=Zfeg2y0uHYt4V4Dsu1fdiXmKoC/3HRFLBgzdDCbp4ZXUoTETIenmti8buPWYl8xbnl fT+fS65tr053wCiUKkdUu6glWYtNnLBEgI2fpWdORr6z0oy2dE0PMhSh9XsC9rloFiG1 Lla4L+EqC4/UbC8MQn8bI7x4+K4WK4ii4ghnRxVyWiY5MW8uH9OHOsWO+6aRPh/jGYXp hRUcUbKtP1aunDV/onziFeAb2cFMEcO9VHxyq0fhj9snL8rb7/JOtgVDYyYF/uKQlGnG HHNuLmTDpa/hsv32G78diU/59cfeYHHumtMCIPacDqFOF2f0ZtJqoNMQVTzTyK9gZNc1 UenQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z3nihHLj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u25-20020a170906409900b00991cb7517bbsi3817716ejj.947.2023.08.11.13.51.09; Fri, 11 Aug 2023 13:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z3nihHLj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236260AbjHKTj3 (ORCPT + 99 others); Fri, 11 Aug 2023 15:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231201AbjHKTj2 (ORCPT ); Fri, 11 Aug 2023 15:39:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BEDD30EC; Fri, 11 Aug 2023 12:39:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1D5467963; Fri, 11 Aug 2023 19:39:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC39FC433C7; Fri, 11 Aug 2023 19:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691782767; bh=KlwAT+8owcpMdnQoWuulieq8nFxzS2oyPEO3DiXeFW0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Z3nihHLjbHFVoqzDHPMTR4ppsDou+K/fjjJuT5oZdZMs/DYOIS1/IwrEUdK5EoDrN JeHk9ib8CYs5KMnBmxm51fYJAZKclwJqM5Lx90sZk0+LY+h/dzVZe78pBRPAPoAOLB 3vOc2yoXidHXB0O/tDsEFbgijkGn5nAbzqJwmpAEUAM/TUBKfR+HAQGycUJbcsZWWP 5I/chqhcVJFEXjX6EdiUT0OppW+ZkTmOzYpxR32+5gm0B/+9lf3tuYxS6E2Fkp7ZaH CNr98EKkPM4glQLedBrXXxlgprlRTUnrsdCa8Ia6/NWMg/MTkgKcr9ITk34gxMEK+D 8M6XHbiI449Rw== Received: (nullmailer pid 4003553 invoked by uid 1000); Fri, 11 Aug 2023 19:39:24 -0000 Date: Fri, 11 Aug 2023 13:39:24 -0600 From: Rob Herring To: Anup Patel Cc: Palmer Dabbelt , Paul Walmsley , Thomas Gleixner , Marc Zyngier , Krzysztof Kozlowski , Frank Rowand , Conor Dooley , Atish Patra , Andrew Jones , Sunil V L , Saravana Kannan , Anup Patel , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v7 02/15] of: property: Add fw_devlink support for msi-parent Message-ID: <20230811193924.GA3997669-robh@kernel.org> References: <20230802150018.327079-1-apatel@ventanamicro.com> <20230802150018.327079-3-apatel@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230802150018.327079-3-apatel@ventanamicro.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 02, 2023 at 08:30:05PM +0530, Anup Patel wrote: > This allows fw_devlink to create device links between consumers of > a MSI and the supplier of the MSI. > > Signed-off-by: Anup Patel > --- > drivers/of/property.c | 32 ++++++++++++++++++++++++++++++++ > 1 file changed, 32 insertions(+) > > diff --git a/drivers/of/property.c b/drivers/of/property.c > index ddc75cd50825..bc20535deed7 100644 > --- a/drivers/of/property.c > +++ b/drivers/of/property.c > @@ -1325,6 +1325,37 @@ 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 *parse_msi_parent(struct device_node *np, > + const char *prop_name, int index) > +{ > + struct of_phandle_args sup_args; > + struct device_node *msi_np; > + > + if (IS_ENABLED(CONFIG_SPARC)) > + return NULL; > + > + if (strcmp(prop_name, "msi-parent")) > + return NULL; > + > + msi_np = of_parse_phandle(np, prop_name, 0); > + if (msi_np) { > + if (!of_property_read_bool(msi_np, "#msi-cells")) { Use of_property_present() to check presence. However, this check is wrong. #msi-cells is optional and assumed to be 0 if not present. There's another flavor of of_parse_phandle_with_args() that allows specifying a default cell count, so I think you can get rid of all this checking. > + if (index) { > + of_node_put(msi_np); > + return NULL; > + } > + return msi_np; > + } > + of_node_put(msi_np); > + } > + > + if (of_parse_phandle_with_args(np, prop_name, "#msi-cells", index, > + &sup_args)) > + return NULL; > + > + return sup_args.np; > +} > + > static const struct supplier_bindings of_supplier_bindings[] = { > { .parse_prop = parse_clocks, }, > { .parse_prop = parse_interconnects, }, > @@ -1359,6 +1390,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { > { .parse_prop = parse_regulators, }, > { .parse_prop = parse_gpio, }, > { .parse_prop = parse_gpios, }, > + { .parse_prop = parse_msi_parent, }, > {} > }; > > -- > 2.34.1 >