From e0e8fbf84628f3aa80a01ba28db7921224f5d7b9 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Fri, 10 Mar 2023 08:47:20 -0600 Subject: pinctrl: Use of_property_present() for testing DT property presence 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 Reviewed-by: Geert Uytterhoeven Reviewed-by: Jernej Skrabec Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20230310144721.1544669-1-robh@kernel.org [Dropped hunk hitting drivers/pinctrl/renesas/pinctrl.c] Signed-off-by: Linus Walleij --- drivers/pinctrl/sunxi/pinctrl-sunxi.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'drivers/pinctrl/sunxi/pinctrl-sunxi.c') 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"); -- cgit