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>
This commit is contained in:
Patrick Delaunay
2020-09-25 09:41:14 +02:00
committed by Simon Glass
parent 6d9949fe86
commit 89f68302ca
15 changed files with 37 additions and 25 deletions

View File

@@ -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)