From: Patrick DELAUNAY <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [RFC PATCH] dm: add cells_count parameter in *_count_phandle_with_args
Date: Wed, 23 Sep 2020 15:06:14 +0000 [thread overview]
Message-ID: <8224663e5f6b43388fd36f155653a442@SFHDAG6NODE3.st.com> (raw)
In-Reply-To: <CAPnjgZ2SK0-a75tO6HwVwKtA7rTPCmqeL0M16YgO_=gx5MgGqg@mail.gmail.com>
Hi Simon,
> From: Simon Glass <sjg@chromium.org>
> Sent: mardi 22 septembre 2020 20:49
>
> On Thu, 10 Sep 2020 at 10:44, Patrick Delaunay <patrick.delaunay@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@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@chromium.org>
>
> A test would go a long way here.
Sure, I will add a test in the real patch...
I send RFC without test just to be sure that adding parameter in *_count_phandle_with_args()
is a better solution than adding a new API.
Proposition 1 (it is the RFC content): add argument in current API
Example:
of_count_phandle_with_args(node, "clocks", "#clock-cells", 0);
ofnode_count_phandle_with_args(node, "resets", "#reset-cells", 0);
dev_count_phandle_with_args(node, "phys", "#phy-cells", 0);
dev_count_phandle_with_args(node, "test", NULL, 3);
ofnode_count_phandle_with_args(node, "test", NULL, 3);
Proposition 2: new API *count_phandle_with_cell_count
of_count_phandle_with_args(node, "clocks", "#clock-cells");
ofnode_count_phandle_with_args(node, "resets", "#reset-cells");
dev_count_phandle_with_args(node, "phys", "#phy-cells");
dev_count_phandle_with_fixed_args(node, "test", 3);
ofnode_count_phandle_with_fixed_args(node, "test", 3);
I think that Proposition 1 (this RFC) is more clear because parameters are aligned
with other API *read_phandle_with_args
But proposition 2 is align with Linux API
- of_count_phandle_with_args
- of_parse_phandle_with_fixed_args
And avoid to change all the current users of *count_phandle_with_args
Patrick
next prev parent reply other threads:[~2020-09-23 15:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-10 16:43 [RFC PATCH] dm: add cells_count parameter in *_count_phandle_with_args Patrick Delaunay
2020-09-22 18:48 ` Simon Glass
2020-09-23 15:06 ` Patrick DELAUNAY [this message]
2020-09-24 16:08 ` Simon Glass
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8224663e5f6b43388fd36f155653a442@SFHDAG6NODE3.st.com \
--to=patrick.delaunay@st.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox