dm: ofnode: rename ofnode_read_prop() to ofnode_get_property()
This function returns the pointer to the value of a node property.
The current name ofnode_read_prop() is confusing. Follow the naming
of_get_property() from Linux.
The return type (const u32 *) is wrong. DT property values can be
strings as well as integers. This is why of_get_property/fdt_getprop
returns an opaque pointer.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Simon Glass <sjg@chromium.org>
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index b79f26d..6067914 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -141,8 +141,7 @@
name = ofnode_get_name(node);
dm_dbg("bind node %s\n", name);
- compat_list = (const char *)ofnode_read_prop(node, "compatible",
- &compat_length);
+ compat_list = ofnode_get_property(node, "compatible", &compat_length);
if (!compat_list) {
if (compat_length == -FDT_ERR_NOTFOUND) {
dm_dbg("Device '%s' has no compatible string\n", name);
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index d9441c8..372d07a 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -432,7 +432,7 @@
return ret;
}
-const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp)
+const void *ofnode_get_property(ofnode node, const char *propname, int *lenp)
{
if (ofnode_is_np(node))
return of_get_property(ofnode_to_np(node), propname, lenp);
@@ -503,7 +503,7 @@
* #size-cells. They need to be 3 and 2 accordingly. However,
* for simplicity we skip the check here.
*/
- cell = ofnode_read_prop(node, propname, &len);
+ cell = ofnode_get_property(node, propname, &len);
if (!cell)
goto fail;
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 36293ba..eafe727 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -116,7 +116,7 @@
const u32 *dev_read_prop(struct udevice *dev, const char *propname, int *lenp)
{
- return ofnode_read_prop(dev_ofnode(dev), propname, lenp);
+ return ofnode_get_property(dev_ofnode(dev), propname, lenp);
}
int dev_read_alias_seq(struct udevice *dev, int *devnump)
diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index c96e26e..5924ade 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -197,7 +197,7 @@
int upto;
int len;
- cell = ofnode_read_prop(node, "linux,keymap", &len);
+ cell = ofnode_get_property(node, "linux,keymap", &len);
ec->matrix_count = len / 4;
ec->matrix = calloc(ec->matrix_count, sizeof(*ec->matrix));
if (!ec->matrix) {
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 4223040..86df141 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -763,7 +763,7 @@
int len;
int i;
- prop = ofnode_read_prop(node, "ranges", &len);
+ prop = ofnode_get_property(node, "ranges", &len);
if (!prop)
return -EINVAL;
pci_addr_cells = ofnode_read_simple_addr_cells(node);
diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c
index 02e2690..114952a 100644
--- a/drivers/pinctrl/pinctrl-uclass.c
+++ b/drivers/pinctrl/pinctrl-uclass.c
@@ -134,7 +134,7 @@
* If this node has "compatible" property, this is not
* a pin configuration node, but a normal device. skip.
*/
- ofnode_read_prop(node, "compatible", &ret);
+ ofnode_get_property(node, "compatible", &ret);
if (ret >= 0)
continue;
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index c3d8db5..15ad519 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -473,14 +473,14 @@
struct display_timing *config);
/**
- * ofnode_read_prop()- - read a node property
+ * ofnode_get_property()- - get a pointer to the value of a node property
*
* @node: node to read
* @propname: property to read
* @lenp: place to put length on success
* @return pointer to property, or NULL if not found
*/
-const u32 *ofnode_read_prop(ofnode node, const char *propname, int *lenp);
+const void *ofnode_get_property(ofnode node, const char *propname, int *lenp);
/**
* ofnode_is_available() - check if a node is marked available
diff --git a/include/dm/read.h b/include/dm/read.h
index 6dd1634..b86a2f5 100644
--- a/include/dm/read.h
+++ b/include/dm/read.h
@@ -446,7 +446,7 @@
static inline const u32 *dev_read_prop(struct udevice *dev,
const char *propname, int *lenp)
{
- return ofnode_read_prop(dev_ofnode(dev), propname, lenp);
+ return ofnode_get_property(dev_ofnode(dev), propname, lenp);
}
static inline int dev_read_alias_seq(struct udevice *dev, int *devnump)