[RFC PATCH] dm: add cells_count parameter in *_count_phandle_with_args

Simon Glass sjg at chromium.org
Tue Sep 22 20:48:37 CEST 2020


On Thu, 10 Sep 2020 at 10:44, Patrick Delaunay <patrick.delaunay at st.com> wrote:
>
> 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 at st.com>
> ---
> I push today this RFC.
>
> It is linked to previous serie [1] but it is not a blocking point today
> as no user use this API with cells_name = NULL
> + dev_count_phandle_with_args
> + ofnode_count_phandle_with_args
>
> But I think it is the good time to modify these functions as they are not
> hugely used: it is the proposition in this RFC.
>
> It is just a RFC because I don't sure if I can modify the existing API
> even if parameters are aligned with *_parse_phandle_with_args.
>
> I can also to add new APIs to use when cells_name is NULL:
> + dev_count_phandle_with_cell_count(node, list_name, cell_count);
> + ofnode_count_phandle_with_cell_count(node, list_name, cell_count);
>
> and raise a error if cells_name == NULL in existing function
> + dev_count_phandle_with_args
> + ofnode_count_phandle_with_args
>
> [1] http://patchwork.ozlabs.org/project/uboot/list/?series=200899
>     "dm: add cells_count parameter in live DT APIs of_parse_phandle_with_args"
>
>
>  board/st/stm32mp1/stm32mp1.c    | 2 +-
>  drivers/clk/clk-uclass.c        | 4 ++--
>  drivers/core/of_access.c        | 7 ++++---
>  drivers/core/ofnode.c           | 6 +++---
>  drivers/core/read.c             | 5 +++--
>  drivers/phy/phy-uclass.c        | 2 +-
>  drivers/reset/reset-uclass.c    | 2 +-
>  drivers/usb/host/ehci-generic.c | 4 ++--
>  include/dm/of_access.h          | 4 +++-
>  include/dm/ofnode.h             | 3 ++-
>  include/dm/read.h               | 8 +++++---
>  11 files changed, 27 insertions(+), 20 deletions(-)'

Reviewed-by: Simon Glass <sjg at chromium.org>

A test would go a long way here.


More information about the U-Boot mailing list