linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpio: Use of_property_read_bool() for boolean properties
@ 2023-03-10 14:47 Rob Herring
  2023-03-10 22:40 ` Linus Walleij
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski; +Cc: devicetree, linux-gpio, linux-kernel

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/gpio/gpio-stp-xway.c | 2 +-
 drivers/gpio/gpio-tb10x.c    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-stp-xway.c b/drivers/gpio/gpio-stp-xway.c
index 0ce1543426a4..dd3bdc221b94 100644
--- a/drivers/gpio/gpio-stp-xway.c
+++ b/drivers/gpio/gpio-stp-xway.c
@@ -292,7 +292,7 @@ static int xway_stp_probe(struct platform_device *pdev)
 	}
 
 	/* check which edge trigger we should use, default to a falling edge */
-	if (!of_find_property(pdev->dev.of_node, "lantiq,rising", NULL))
+	if (!of_property_present(pdev->dev.of_node, "lantiq,rising"))
 		chip->edge = XWAY_STP_FALLING;
 
 	clk = devm_clk_get(&pdev->dev, NULL);
diff --git a/drivers/gpio/gpio-tb10x.c b/drivers/gpio/gpio-tb10x.c
index de6afa3f9716..0422637796cb 100644
--- a/drivers/gpio/gpio-tb10x.c
+++ b/drivers/gpio/gpio-tb10x.c
@@ -167,7 +167,7 @@ static int tb10x_gpio_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, tb10x_gpio);
 
-	if (of_find_property(np, "interrupt-controller", NULL)) {
+	if (of_property_present(np, "interrupt-controller")) {
 		struct irq_chip_generic *gc;
 
 		ret = platform_get_irq(pdev, 0);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: Use of_property_read_bool() for boolean properties
  2023-03-10 14:47 [PATCH] gpio: Use of_property_read_bool() for boolean properties Rob Herring
@ 2023-03-10 22:40 ` Linus Walleij
  2023-03-11  3:00   ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Walleij @ 2023-03-10 22:40 UTC (permalink / raw)
  To: Rob Herring; +Cc: Bartosz Golaszewski, devicetree, linux-gpio, linux-kernel

On Fri, Mar 10, 2023 at 3:47 PM Rob Herring <robh@kernel.org> wrote:

> It is preferred to use typed property access functions (i.e.
> of_property_read_<type> functions) rather than low-level
> of_get_property/of_find_property functions for reading properties.
> Convert reading boolean properties to to of_property_read_bool().
>
> Signed-off-by: Rob Herring <robh@kernel.org>

You are using of_property_present() rather than of_property_read_bool()
but I'm not picky about commit message details.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: Use of_property_read_bool() for boolean properties
  2023-03-10 22:40 ` Linus Walleij
@ 2023-03-11  3:00   ` Rob Herring
  0 siblings, 0 replies; 3+ messages in thread
From: Rob Herring @ 2023-03-11  3:00 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Bartosz Golaszewski, devicetree, linux-gpio, linux-kernel

On Fri, Mar 10, 2023 at 4:41 PM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> On Fri, Mar 10, 2023 at 3:47 PM Rob Herring <robh@kernel.org> wrote:
>
> > It is preferred to use typed property access functions (i.e.
> > of_property_read_<type> functions) rather than low-level
> > of_get_property/of_find_property functions for reading properties.
> > Convert reading boolean properties to to of_property_read_bool().
> >
> > Signed-off-by: Rob Herring <robh@kernel.org>
>
> You are using of_property_present() rather than of_property_read_bool()
> but I'm not picky about commit message details.

ugg, well, it's the commit message that's correct. I missed updating
this one to use of_property_read_bool().

Rob

> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
>
> Yours,
> Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-11  3:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-10 14:47 [PATCH] gpio: Use of_property_read_bool() for boolean properties Rob Herring
2023-03-10 22:40 ` Linus Walleij
2023-03-11  3:00   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).