Commit 6a71ca74 authored by Rob Herring's avatar Rob Herring

sparc: 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.

Link: https://lore.kernel.org/r/20230310144659.1541247-1-robh@kernel.orgSigned-off-by: default avatarRob Herring <robh@kernel.org>
parent 6bb1504d
...@@ -29,7 +29,7 @@ static int of_bus_pci_match(struct device_node *np) ...@@ -29,7 +29,7 @@ static int of_bus_pci_match(struct device_node *np)
* parent as-is, not with the PCI translate * parent as-is, not with the PCI translate
* method which chops off the top address cell. * method which chops off the top address cell.
*/ */
if (!of_find_property(np, "ranges", NULL)) if (!of_property_present(np, "ranges"))
return 0; return 0;
return 1; return 1;
...@@ -223,7 +223,7 @@ static int __init build_one_resource(struct device_node *parent, ...@@ -223,7 +223,7 @@ static int __init build_one_resource(struct device_node *parent,
static int __init use_1to1_mapping(struct device_node *pp) static int __init use_1to1_mapping(struct device_node *pp)
{ {
/* If we have a ranges property in the parent, use it. */ /* If we have a ranges property in the parent, use it. */
if (of_find_property(pp, "ranges", NULL) != NULL) if (of_property_present(pp, "ranges"))
return 0; return 0;
/* Some SBUS devices use intermediate nodes to express /* Some SBUS devices use intermediate nodes to express
......
...@@ -58,7 +58,7 @@ static int of_bus_pci_match(struct device_node *np) ...@@ -58,7 +58,7 @@ static int of_bus_pci_match(struct device_node *np)
* parent as-is, not with the PCI translate * parent as-is, not with the PCI translate
* method which chops off the top address cell. * method which chops off the top address cell.
*/ */
if (!of_find_property(np, "ranges", NULL)) if (!of_property_present(np, "ranges"))
return 0; return 0;
return 1; return 1;
...@@ -78,7 +78,7 @@ static int of_bus_simba_match(struct device_node *np) ...@@ -78,7 +78,7 @@ static int of_bus_simba_match(struct device_node *np)
* simba. * simba.
*/ */
if (of_node_name_eq(np, "pci")) { if (of_node_name_eq(np, "pci")) {
if (!of_find_property(np, "ranges", NULL)) if (!of_property_present(np, "ranges"))
return 1; return 1;
} }
...@@ -283,7 +283,7 @@ static int __init build_one_resource(struct device_node *parent, ...@@ -283,7 +283,7 @@ static int __init build_one_resource(struct device_node *parent,
static int __init use_1to1_mapping(struct device_node *pp) static int __init use_1to1_mapping(struct device_node *pp)
{ {
/* If we have a ranges property in the parent, use it. */ /* If we have a ranges property in the parent, use it. */
if (of_find_property(pp, "ranges", NULL) != NULL) if (of_property_present(pp, "ranges"))
return 0; return 0;
/* If the parent is the dma node of an ISA bus, pass /* If the parent is the dma node of an ISA bus, pass
......
...@@ -162,7 +162,7 @@ int of_bus_sbus_match(struct device_node *np) ...@@ -162,7 +162,7 @@ int of_bus_sbus_match(struct device_node *np)
* don't have some intervening real bus that provides * don't have some intervening real bus that provides
* ranges based translations. * ranges based translations.
*/ */
if (of_find_property(dp, "ranges", NULL) != NULL) if (of_property_present(dp, "ranges"))
break; break;
dp = dp->parent; dp = dp->parent;
......
...@@ -502,7 +502,7 @@ static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg) ...@@ -502,7 +502,7 @@ static void *fill_in_one_cpu(struct device_node *dp, int cpuid, int arg)
struct device_node *portid_parent = NULL; struct device_node *portid_parent = NULL;
int portid = -1; int portid = -1;
if (of_find_property(dp, "cpuid", NULL)) { if (of_property_present(dp, "cpuid")) {
int limit = 2; int limit = 2;
portid_parent = dp; portid_parent = dp;
......
...@@ -277,7 +277,7 @@ static int clock_probe(struct platform_device *op) ...@@ -277,7 +277,7 @@ static int clock_probe(struct platform_device *op)
return -ENODEV; return -ENODEV;
/* Only the primary RTC has an address property */ /* Only the primary RTC has an address property */
if (!of_find_property(dp, "address", NULL)) if (!of_property_present(dp, "address"))
return -ENODEV; return -ENODEV;
m48t59_rtc.resource = &op->resource[0]; m48t59_rtc.resource = &op->resource[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