aboutsummaryrefslogtreecommitdiff
path: root/drivers/core
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-09-25 09:41:14 +0200
committerSimon Glass <sjg@chromium.org>2020-10-06 09:07:54 -0600
commit89f68302cacaa41330959420d7329b7c89afdd88 (patch)
tree30d80261c2bc56c4a00a9cb49910ce0670ce7ad0 /drivers/core
parent6d9949fe866751c527c5dafab5350af89b7b8332 (diff)
downloadu-boot-89f68302cacaa41330959420d7329b7c89afdd88.zip
u-boot-89f68302cacaa41330959420d7329b7c89afdd88.tar.gz
u-boot-89f68302cacaa41330959420d7329b7c89afdd88.tar.bz2
dm: add cells_count parameter in *_count_phandle_with_args
The cell_count argument is required when cells_name is NULL. This patch adds this parameter in live tree API - of_count_phandle_with_args - ofnode_count_phandle_with_args - dev_count_phandle_with_args This parameter solves issue when these API is used to count the number of element of a cell without cell name. This parameter allow to force the size cell. For example: count = dev_count_phandle_with_args(dev, "array", NULL, 3); Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/of_access.c7
-rw-r--r--drivers/core/ofnode.c6
-rw-r--r--drivers/core/read.c5
3 files changed, 10 insertions, 8 deletions
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index bcf1644..0a12e9b 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -756,10 +756,11 @@ int of_parse_phandle_with_args(const struct device_node *np,
}
int of_count_phandle_with_args(const struct device_node *np,
- const char *list_name, const char *cells_name)
+ const char *list_name, const char *cells_name,
+ int cell_count)
{
- return __of_parse_phandle_with_args(np, list_name, cells_name, 0,
- -1, NULL);
+ return __of_parse_phandle_with_args(np, list_name, cells_name,
+ cell_count, -1, NULL);
}
static void of_alias_add(struct alias_prop *ap, struct device_node *np,
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 79fcdf5..7d1b895 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -432,15 +432,15 @@ int ofnode_parse_phandle_with_args(ofnode node, const char *list_name,
}
int ofnode_count_phandle_with_args(ofnode node, const char *list_name,
- const char *cells_name)
+ const char *cells_name, int cell_count)
{
if (ofnode_is_np(node))
return of_count_phandle_with_args(ofnode_to_np(node),
- list_name, cells_name);
+ list_name, cells_name, cell_count);
else
return fdtdec_parse_phandle_with_args(gd->fdt_blob,
ofnode_to_offset(node), list_name, cells_name,
- 0, -1, NULL);
+ cell_count, -1, NULL);
}
ofnode ofnode_path(const char *path)
diff --git a/drivers/core/read.c b/drivers/core/read.c
index 86f3f88..0761258 100644
--- a/drivers/core/read.c
+++ b/drivers/core/read.c
@@ -214,10 +214,11 @@ int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name,
}
int dev_count_phandle_with_args(const struct udevice *dev,
- const char *list_name, const char *cells_name)
+ const char *list_name, const char *cells_name,
+ int cell_count)
{
return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name,
- cells_name);
+ cells_name, cell_count);
}
int dev_read_addr_cells(const struct udevice *dev)