diff options
author | Patrick Delaunay <patrick.delaunay@st.com> | 2020-09-25 09:41:14 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-10-06 09:07:54 -0600 |
commit | 89f68302cacaa41330959420d7329b7c89afdd88 (patch) | |
tree | 30d80261c2bc56c4a00a9cb49910ce0670ce7ad0 /include/dm/read.h | |
parent | 6d9949fe866751c527c5dafab5350af89b7b8332 (diff) | |
download | u-boot-89f68302cacaa41330959420d7329b7c89afdd88.tar.gz |
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 'include/dm/read.h')
-rw-r--r-- | include/dm/read.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/dm/read.h b/include/dm/read.h index 67db94adfc..0585eb1228 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -429,12 +429,14 @@ int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name, * @dev: device whose node containing a list * @list_name: property name that contains a list * @cells_name: property name that specifies phandles' arguments count + * @cells_count: Cell count to use if @cells_name is NULL * @Returns number of phandle found on success, on error returns appropriate * errno value. */ 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); /** * dev_read_addr_cells() - Get the number of address cells for a device's node @@ -880,10 +882,10 @@ static inline int dev_read_phandle_with_args(const struct udevice *dev, } static inline 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); } static inline int dev_read_addr_cells(const struct udevice *dev) |