Skip to contentSkip to conversation

of: Use preferred of_property_read_* functions

PATCH New Rob Herring 1 participant 1 message Feb 15, 2023 Device tree

lore
Share & tools
lore

Rob Herring

author maintainer
#0 lore raw

PATCH 1/1 of: Use preferred of_property_read_* functions

Replace instances of of_get_property/of_find_property() with appropriate typed of_property_read_*() functions.

---
 drivers/of/platform.c | 4 +---
 drivers/of/property.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/of/platform.c +1 -3
index 284379e67649..472e1706983d 100644
@@ -250,9 +250,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 		of_device_make_bus_id(&dev->dev);
 
 	/* Allow the HW Peripheral ID to be overridden */
-	prop = of_get_property(node, "arm,primecell-periphid", NULL);
-	if (prop)
-		dev->periphid = of_read_ulong(prop, 1);
+	of_property_read_u32(node, "arm,primecell-periphid", &dev->periphid);
 
 	ret = of_address_to_resource(node, 0, &dev->res);
 	if (ret) {
drivers/of/property.c +1 -1
index ff71d2ac26cb..a229536f7564 100644
@@ -1358,7 +1358,7 @@ static struct device_node *parse_gpio_compat(struct device_node *np,
 	 * Ignore node with gpio-hog property since its gpios are all provided
 	 * by its parent.
 	 */
-	if (of_find_property(np, "gpio-hog", NULL))
+	if (of_property_read_bool(np, "gpio-hog"))
 		return NULL;
 
 	if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index,
Signature · 1 line
2.39.1