Commit bcc85868 authored by Rob Herring's avatar Rob Herring Committed by Jakub Kicinski

net: Use of_property_present() for testing DT property presence

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: default avatarRob Herring <robh@kernel.org>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Acked-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230310144716.1544083-1-robh@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent b39212d5
...@@ -131,7 +131,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child) ...@@ -131,7 +131,7 @@ bool of_mdiobus_child_is_phy(struct device_node *child)
return true; return true;
} }
if (!of_find_property(child, "compatible", NULL)) if (!of_property_present(child, "compatible"))
return true; return true;
return false; return false;
...@@ -203,7 +203,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np) ...@@ -203,7 +203,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
/* auto scan for PHYs with empty reg property */ /* auto scan for PHYs with empty reg property */
for_each_available_child_of_node(np, child) { for_each_available_child_of_node(np, child) {
/* Skip PHYs with reg property set */ /* Skip PHYs with reg property set */
if (of_find_property(child, "reg", NULL)) if (of_property_present(child, "reg"))
continue; continue;
for (addr = 0; addr < PHY_MAX_ADDR; addr++) { for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
......
...@@ -129,7 +129,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, ...@@ -129,7 +129,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
sdio->drive_strength = val; sdio->drive_strength = val;
/* make sure there are interrupts defined in the node */ /* make sure there are interrupts defined in the node */
if (!of_find_property(np, "interrupts", NULL)) if (!of_property_present(np, "interrupts"))
return; return;
irq = irq_of_parse_and_map(np, 0); irq = irq_of_parse_and_map(np, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment