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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 4A6B8C6FD19 for ; Mon, 13 Mar 2023 10:19:26 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fH1N+vT+rfKDV0Xazu8peufaRsoKc4EASipPcalB3sk=; b=hIk7CFo4XDQlKz WOKJoZ8vKxzJO4cg8Nw1vCFzPun06+yAsX/Bz7alXaEDTLuNiH5OBiQ2j5nJXDbcPi/F2zj0XrIy7 BZQpntmDw9i1u9VMSqgOGbnYJiSDSj7487dK7YikGrfQp1OmlawQgQi/237hO+d0nHzoKDh8wZTTt Yr0OFpkIcugbAlAcuka7lBs+jCsaVvQ7weFKbFQUhpxWSiAmPgFJKGKx4uNte0Vhhl37y+/W1xw9K 1581yhWXZ5u7vW9uIoJp3yuUWbO9j9nVYlCfypEQuSjMa6FJ82LJwnjF8BKR4Qrc6suFhnh6ZHxJm EheoLrfBk1Ay+Y/IZe0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbfG4-005965-JA; Mon, 13 Mar 2023 10:18:24 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pbfG0-00595N-4a; Mon, 13 Mar 2023 10:18:22 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 44B714B3; Mon, 13 Mar 2023 03:18:58 -0700 (PDT) Received: from slackpad.lan (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A408A3F71A; Mon, 13 Mar 2023 03:18:11 -0700 (PDT) Date: Mon, 13 Mar 2023 10:17:51 +0000 From: Andre Przywara To: Rob Herring Cc: Sean Wang , Linus Walleij , Tony Lindgren , Haojian Zhuang , Maxime Coquelin , Alexandre Torgue , Geert Uytterhoeven , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Matthias Brugger , AngeloGioacchino Del Regno , devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH] pinctrl: Use of_property_present() for testing DT property presence Message-ID: <20230313101751.18003b2d@slackpad.lan> In-Reply-To: <20230310144721.1544669-1-robh@kernel.org> References: <20230310144721.1544669-1-robh@kernel.org> Organization: Arm Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230313_031820_330265_103814D6 X-CRM114-Status: GOOD ( 25.15 ) 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 Fri, 10 Mar 2023 08:47:20 -0600 Rob Herring wrote: > It is preferred to use typed property access functions (i.e. > of_property_read_ functions) rather than low-level > of_get_property/of_find_property functions for reading properties. As > part of this, convert of_get_property/of_find_property calls to the > recently added of_property_present() helper when we just want to test > for presence of a property and nothing more. > > Signed-off-by: Rob Herring > --- > drivers/pinctrl/mediatek/pinctrl-moore.c | 2 +- > drivers/pinctrl/pinctrl-single.c | 4 ++-- > drivers/pinctrl/pinctrl-stmfx.c | 2 +- > drivers/pinctrl/renesas/pinctrl.c | 4 ++-- > drivers/pinctrl/stm32/pinctrl-stm32.c | 2 +- > drivers/pinctrl/sunxi/pinctrl-sunxi.c | 20 ++++++++++---------- For sunxi: Reviewed-by: Andre Przywara Cheers, Andre > 6 files changed, 17 insertions(+), 17 deletions(-) > > diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c > index 007b98ce5631..8649a2f9d324 100644 > --- a/drivers/pinctrl/mediatek/pinctrl-moore.c > +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c > @@ -586,7 +586,7 @@ static int mtk_build_gpiochip(struct mtk_pinctrl *hw) > * Documentation/devicetree/bindings/gpio/gpio.txt on how to > * bind pinctrl and gpio drivers via the "gpio-ranges" property. > */ > - if (!of_find_property(hw->dev->of_node, "gpio-ranges", NULL)) { > + if (!of_property_present(hw->dev->of_node, "gpio-ranges")) { > ret = gpiochip_add_pin_range(chip, dev_name(hw->dev), 0, 0, > chip->ngpio); > if (ret < 0) { > diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c > index 190923757cda..0dabbcf68b9f 100644 > --- a/drivers/pinctrl/pinctrl-single.c > +++ b/drivers/pinctrl/pinctrl-single.c > @@ -939,11 +939,11 @@ static int pcs_parse_pinconf(struct pcs_device *pcs, struct device_node *np, > > /* cacluate how much properties are supported in current node */ > for (i = 0; i < ARRAY_SIZE(prop2); i++) { > - if (of_find_property(np, prop2[i].name, NULL)) > + if (of_property_present(np, prop2[i].name)) > nconfs++; > } > for (i = 0; i < ARRAY_SIZE(prop4); i++) { > - if (of_find_property(np, prop4[i].name, NULL)) > + if (of_property_present(np, prop4[i].name)) > nconfs++; > } > if (!nconfs) > diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c > index 1181c4b506b1..3c031692e44d 100644 > --- a/drivers/pinctrl/pinctrl-stmfx.c > +++ b/drivers/pinctrl/pinctrl-stmfx.c > @@ -632,7 +632,7 @@ static int stmfx_pinctrl_probe(struct platform_device *pdev) > pctl->dev = &pdev->dev; > pctl->stmfx = stmfx; > > - if (!of_find_property(np, "gpio-ranges", NULL)) { > + if (!of_property_present(np, "gpio-ranges")) { > dev_err(pctl->dev, "missing required gpio-ranges property\n"); > return -EINVAL; > } > diff --git a/drivers/pinctrl/renesas/pinctrl.c b/drivers/pinctrl/renesas/pinctrl.c > index b74147800319..5c71e168b370 100644 > --- a/drivers/pinctrl/renesas/pinctrl.c > +++ b/drivers/pinctrl/renesas/pinctrl.c > @@ -125,8 +125,8 @@ static int sh_pfc_dt_subnode_to_map(struct pinctrl_dev *pctldev, > * inside a subnode nor across subnodes. > */ > if (!pmx->func_prop_name) { > - if (of_find_property(np, "groups", NULL) || > - of_find_property(np, "pins", NULL)) { > + if (of_property_present(np, "groups")|| > + of_property_present(np, "pins")) { > pmx->func_prop_name = "function"; > pmx->groups_prop_name = "groups"; > pmx->pins_prop_name = "pins"; > diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c > index cb33a23ab0c1..66a25becd8f5 100644 > --- a/drivers/pinctrl/stm32/pinctrl-stm32.c > +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c > @@ -1374,7 +1374,7 @@ static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pde > struct device_node *parent; > struct irq_domain *domain; > > - if (!of_find_property(np, "interrupt-parent", NULL)) > + if (!of_property_present(np, "interrupt-parent")) > return NULL; > > parent = of_irq_find_parent(np); > diff --git a/drivers/pinctrl/sunxi/pinctrl-sunxi.c b/drivers/pinctrl/sunxi/pinctrl-sunxi.c > index f35179eceb4e..1dc1882cbdd7 100644 > --- a/drivers/pinctrl/sunxi/pinctrl-sunxi.c > +++ b/drivers/pinctrl/sunxi/pinctrl-sunxi.c > @@ -224,16 +224,16 @@ static int sunxi_pctrl_get_group_pins(struct pinctrl_dev *pctldev, > > static bool sunxi_pctrl_has_bias_prop(struct device_node *node) > { > - return of_find_property(node, "bias-pull-up", NULL) || > - of_find_property(node, "bias-pull-down", NULL) || > - of_find_property(node, "bias-disable", NULL) || > - of_find_property(node, "allwinner,pull", NULL); > + return of_property_present(node, "bias-pull-up") || > + of_property_present(node, "bias-pull-down") || > + of_property_present(node, "bias-disable") || > + of_property_present(node, "allwinner,pull"); > } > > static bool sunxi_pctrl_has_drive_prop(struct device_node *node) > { > - return of_find_property(node, "drive-strength", NULL) || > - of_find_property(node, "allwinner,drive", NULL); > + return of_property_present(node, "drive-strength") || > + of_property_present(node, "allwinner,drive"); > } > > static int sunxi_pctrl_parse_bias_prop(struct device_node *node) > @@ -241,13 +241,13 @@ static int sunxi_pctrl_parse_bias_prop(struct device_node *node) > u32 val; > > /* Try the new style binding */ > - if (of_find_property(node, "bias-pull-up", NULL)) > + if (of_property_present(node, "bias-pull-up")) > return PIN_CONFIG_BIAS_PULL_UP; > > - if (of_find_property(node, "bias-pull-down", NULL)) > + if (of_property_present(node, "bias-pull-down")) > return PIN_CONFIG_BIAS_PULL_DOWN; > > - if (of_find_property(node, "bias-disable", NULL)) > + if (of_property_present(node, "bias-disable")) > return PIN_CONFIG_BIAS_DISABLE; > > /* And fall back to the old binding */ > @@ -1424,7 +1424,7 @@ static int sunxi_pinctrl_setup_debounce(struct sunxi_pinctrl *pctl, > return 0; > > /* If we don't have any setup, bail out */ > - if (!of_find_property(node, "input-debounce", NULL)) > + if (!of_property_present(node, "input-debounce")) > return 0; > > losc = devm_clk_get(pctl->dev, "losc"); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel