linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Use of_property_present() for testing DT property presence
@ 2023-03-10 14:47 Rob Herring
  2023-03-11 11:51 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rob Herring @ 2023-03-10 14:47 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Arend van Spriel,
	Franky Lin, Hante Meuleman, Kalle Valo
  Cc: devicetree, netdev, linux-kernel, linux-wireless,
	brcm80211-dev-list.pdl, SHA-cyfmac-dev-list

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. 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 <robh@kernel.org>
---
 drivers/net/mdio/of_mdio.c                            | 4 ++--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mdio/of_mdio.c b/drivers/net/mdio/of_mdio.c
index 510822d6d0d9..bf10d0688eea 100644
--- a/drivers/net/mdio/of_mdio.c
+++ b/drivers/net/mdio/of_mdio.c
@@ -131,7 +131,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child)
 		return true;
 	}
 
-	if (!of_find_property(child, "compatible", NULL))
+	if (!of_property_present(child, "compatible"))
 		return true;
 
 	return false;
@@ -203,7 +203,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
 	/* auto scan for PHYs with empty reg property */
 	for_each_available_child_of_node(np, child) {
 		/* Skip PHYs with reg property set */
-		if (of_find_property(child, "reg", NULL))
+		if (of_property_present(child, "reg"))
 			continue;
 
 		for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
index fdd0c9abc1a1..e62f880fdde7 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
@@ -122,7 +122,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 		sdio->drive_strength = val;
 
 	/* make sure there are interrupts defined in the node */
-	if (!of_find_property(np, "interrupts", NULL))
+	if (!of_property_present(np, "interrupts"))
 		return;
 
 	irq = irq_of_parse_and_map(np, 0);
-- 
2.39.2


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

* Re: [PATCH] net: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] net: Use of_property_present() for testing DT property presence Rob Herring
@ 2023-03-11 11:51 ` Simon Horman
  2023-03-13  6:56 ` Kalle Valo
  2023-03-14  0:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-03-11 11:51 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Arend van Spriel,
	Franky Lin, Hante Meuleman, Kalle Valo, devicetree, netdev,
	linux-kernel, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list

On Fri, Mar 10, 2023 at 08:47:16AM -0600, Rob Herring 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. 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 <robh@kernel.org>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


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

* Re: [PATCH] net: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] net: Use of_property_present() for testing DT property presence Rob Herring
  2023-03-11 11:51 ` Simon Horman
@ 2023-03-13  6:56 ` Kalle Valo
  2023-03-14  0:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2023-03-13  6:56 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Arend van Spriel,
	Franky Lin, Hante Meuleman, devicetree, netdev, linux-kernel,
	linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list

Rob Herring <robh@kernel.org> writes:

> 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. 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 <robh@kernel.org>
> ---
>  drivers/net/mdio/of_mdio.c                            | 4 ++--
>  drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

For wireless:

Acked-by: Kalle Valo <kvalo@kernel.org>

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH] net: Use of_property_present() for testing DT property presence
  2023-03-10 14:47 [PATCH] net: Use of_property_present() for testing DT property presence Rob Herring
  2023-03-11 11:51 ` Simon Horman
  2023-03-13  6:56 ` Kalle Valo
@ 2023-03-14  0:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-03-14  0:20 UTC (permalink / raw)
  To: Rob Herring
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	aspriel, franky.lin, hante.meuleman, kvalo, devicetree, netdev,
	linux-kernel, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 10 Mar 2023 08:47:16 -0600 you 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. 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.
> 
> [...]

Here is the summary with links:
  - net: Use of_property_present() for testing DT property presence
    https://git.kernel.org/netdev/net-next/c/bcc858689db5

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2023-03-14  0:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 14:47 [PATCH] net: Use of_property_present() for testing DT property presence Rob Herring
2023-03-11 11:51 ` Simon Horman
2023-03-13  6:56 ` Kalle Valo
2023-03-14  0:20 ` patchwork-bot+netdevbpf

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).