Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.org
Signed-off-by: Rob Herring <robh@kernel.org>

+8 -8
+2 -2
arch/sparc/kernel/of_device_32.c
··· 29 29 * parent as-is, not with the PCI translate 30 30 * method which chops off the top address cell. 31 31 */ 32 - if (!of_find_property(np, "ranges", NULL)) 32 + if (!of_property_present(np, "ranges")) 33 33 return 0; 34 34 35 35 return 1; ··· 223 223 static int __init use_1to1_mapping(struct device_node *pp) 224 224 { 225 225 /* If we have a ranges property in the parent, use it. */ 226 - if (of_find_property(pp, "ranges", NULL) != NULL) 226 + if (of_property_present(pp, "ranges")) 227 227 return 0; 228 228 229 229 /* Some SBUS devices use intermediate nodes to express
+3 -3
arch/sparc/kernel/of_device_64.c
··· 58 58 * parent as-is, not with the PCI translate 59 59 * method which chops off the top address cell. 60 60 */ 61 - if (!of_find_property(np, "ranges", NULL)) 61 + if (!of_property_present(np, "ranges")) 62 62 return 0; 63 63 64 64 return 1; ··· 78 78 * simba. 79 79 */ 80 80 if (of_node_name_eq(np, "pci")) { 81 - if (!of_find_property(np, "ranges", NULL)) 81 + if (!of_property_present(np, "ranges")) 82 82 return 1; 83 83 } 84 84 ··· 283 283 static int __init use_1to1_mapping(struct device_node *pp) 284 284 { 285 285 /* If we have a ranges property in the parent, use it. */ 286 - if (of_find_property(pp, "ranges", NULL) != NULL) 286 + if (of_property_present(pp, "ranges")) 287 287 return 0; 288 288 289 289 /* If the parent is the dma node of an ISA bus, pass
+1 -1
arch/sparc/kernel/of_device_common.c
··· 162 162 * don't have some intervening real bus that provides 163 163 * ranges based translations. 164 164 */ 165 - if (of_find_property(dp, "ranges", NULL) != NULL) 165 + if (of_property_present(dp, "ranges")) 166 166 break; 167 167 168 168 dp = dp->parent;
+1 -1
arch/sparc/kernel/prom_64.c
··· 502 502 struct device_node *portid_parent = NULL; 503 503 int portid = -1; 504 504 505 - if (of_find_property(dp, "cpuid", NULL)) { 505 + if (of_property_present(dp, "cpuid")) { 506 506 int limit = 2; 507 507 508 508 portid_parent = dp;
+1 -1
arch/sparc/kernel/time_32.c
··· 277 277 return -ENODEV; 278 278 279 279 /* Only the primary RTC has an address property */ 280 - if (!of_find_property(dp, "address", NULL)) 280 + if (!of_property_present(dp, "address")) 281 281 return -ENODEV; 282 282 283 283 m48t59_rtc.resource = &op->resource[0];