From: Simon Glass <sjg@chromium.org>
To: "Marek Behún" <kabel@kernel.org>
Cc: "Albert Aribaud" <albert.u.boot@aribaud.net>,
"Tom Warren" <twarren@nvidia.com>,
"Aaron Williams" <awilliams@marvell.com>,
"Daniel Schwierzeck" <daniel.schwierzeck@gmail.com>,
"York Sun" <yorksun@freescale.com>,
"Priyanka Jain" <priyanka.jain@nxp.com>,
"Oliver Graute" <oliver.graute@kococonnector.com>,
"Meenakshi Aggarwal" <meenakshi.aggarwal@nxp.com>,
"Wasim Khan" <wasim.khan@nxp.com>,
"Joe Hershberger" <joe.hershberger@ni.com>,
"Ramon Fried" <rfried.dev@gmail.com>,
"Anatolij Gustschin" <agust@denx.de>,
"Neil Armstrong" <narmstrong@baylibre.com>,
"Jagan Teki" <jagan@amarulasolutions.com>,
"Andre Przywara" <andre.przywara@arm.com>,
"Biwen Li" <biwen.li@nxp.com>,
"Chaitanya Sakinam" <chaitanya.sakinam@nxp.com>,
"Anji J" <anji.jagarlmudi@nxp.com>,
"Michael Walle" <michael@walle.cc>, "Stefan Roese" <sr@denx.de>,
"Marek Behún" <marek.behun@nic.cz>,
"Vladimir Oltean" <vladimir.oltean@nxp.com>,
"Bin Meng" <bmeng.cn@gmail.com>,
"Hou Zhiqiang" <Zhiqiang.Hou@nxp.com>,
"Pali Rohár" <pali@kernel.org>,
"Igal Liberman" <igall@marvell.com>,
"U-Boot Mailing List" <u-boot@lists.denx.de>,
u-boot-amlogic@groups.io
Subject: Re: [PATCH u-boot-dm v2] fdt_support: Add fdt_for_each_node_by_compatible() helper macro
Date: Thu, 13 Jan 2022 06:41:23 -0700 [thread overview]
Message-ID: <CAPnjgZ3s8N+TaEYZaOkfwXCi8mHrOh_ecAWSR+_KU-yRmJpiMg@mail.gmail.com> (raw)
In-Reply-To: <20220112232426.7214a3e4@thinkpad>
Hi Marek,
On Wed, 12 Jan 2022 at 15:24, Marek Behún <kabel@kernel.org> wrote:
>
> On Wed, 12 Jan 2022 13:04:08 -0700
> Simon Glass <sjg@chromium.org> wrote:
>
> > Hi Marek,
> >
> > On Mon, 10 Jan 2022 at 03:46, Marek Behún <kabel@kernel.org> wrote:
> > >
> > > From: Marek Behún <marek.behun@nic.cz>
> > >
> > > Add macro fdt_for_each_node_by_compatible() to allow iterating over
> > > fdt nodes by compatible string.
> > >
> > > Convert various usages of
> > > off = fdt_node_offset_by_compatible(fdt, start, compat);
> > > while (off > 0) {
> > > code();
> > > off = fdt_node_offset_by_compatible(fdt, off, compat);
> > > }
> > > and similar, to
> > > fdt_for_each_node_by_compatible(off, fdt, start, compat)
> > > code();
> > >
> > > Signed-off-by: Marek Behún <marek.behun@nic.cz>
> > > Reviewed-by: Stefan Roese <sr@denx.de>
> > > ---
> > > Simon, as in v1, this applies on top of marvell/next and we have another
> > > patch for marvell/next that depends on this.
> > > Could we let him apply it there after it is reviewed?
> > > Thanks.
> > >
> > > Changes since v1:
> > > - removed extra space after macro name:
> > > fdt_for_each_node_by_compatible (...)
> > > to
> > > fdt_for_each_node_by_compatible(...)
> > > as requested by Stefan
> > > ---
> > > arch/arm/cpu/armv8/fsl-layerscape/fdt.c | 9 ++-------
> > > arch/arm/cpu/armv8/fsl-layerscape/icid.c | 5 +----
> > > arch/arm/mach-tegra/gpu.c | 5 +----
> > > arch/mips/mach-octeon/octeon_fdt.c | 11 ++---------
> > > arch/powerpc/cpu/mpc85xx/liodn.c | 9 ++-------
> > > board/Marvell/octeon_ebb7304/board.c | 9 +++------
> > > board/congatec/cgtqmx8/spl.c | 7 ++-----
> > > board/freescale/lx2160a/lx2160a.c | 5 +----
> > > common/fdt_support.c | 22 ++++++++--------------
> > > drivers/misc/fsl_portals.c | 6 +-----
> > > drivers/net/fm/fdt.c | 3 +--
> > > drivers/pci/pcie_layerscape_fixup_common.c | 12 ++----------
> > > drivers/phy/marvell/comphy_a3700.c | 10 +++++-----
> > > drivers/video/meson/simplefb_common.c | 7 ++-----
> > > drivers/video/sunxi/simplefb_common.c | 5 ++---
> > > include/fdt_support.h | 6 ++++++
> > > 16 files changed, 41 insertions(+), 90 deletions(-)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > In general we should not be doing this sort of thing. There should be
> > a driver for each string, so we don't need this kind of ad-hoc code.
>
> Dear Simon,
>
> you are right for when this is used for U-Boot functionality.
>
> But when we need to fixup devicetree for Linux, this is the right thing
> to do.
>
> I need this macro for ft_board_setup().
Yes, understood. I think some sort of driver interface would be nice,
perhaps using driver model. Another option would be to register
handlers using the compatible string and have a function that works
through those.
See also the event series here:
https://patchwork.ozlabs.org/project/uboot/list/?series=278607
https://lore.kernel.org/u-boot/20211228082854.1255732-1-sjg@chromium.org/
Regards,
Simon
prev parent reply other threads:[~2022-01-13 13:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-10 10:46 [PATCH u-boot-dm v2] fdt_support: Add fdt_for_each_node_by_compatible() helper macro Marek Behún
2022-01-12 20:04 ` Simon Glass
2022-01-12 22:24 ` Marek Behún
2022-01-13 13:41 ` Simon Glass [this message]
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=CAPnjgZ3s8N+TaEYZaOkfwXCi8mHrOh_ecAWSR+_KU-yRmJpiMg@mail.gmail.com \
--to=sjg@chromium.org \
--cc=Zhiqiang.Hou@nxp.com \
--cc=agust@denx.de \
--cc=albert.u.boot@aribaud.net \
--cc=andre.przywara@arm.com \
--cc=anji.jagarlmudi@nxp.com \
--cc=awilliams@marvell.com \
--cc=biwen.li@nxp.com \
--cc=bmeng.cn@gmail.com \
--cc=chaitanya.sakinam@nxp.com \
--cc=daniel.schwierzeck@gmail.com \
--cc=igall@marvell.com \
--cc=jagan@amarulasolutions.com \
--cc=joe.hershberger@ni.com \
--cc=kabel@kernel.org \
--cc=marek.behun@nic.cz \
--cc=meenakshi.aggarwal@nxp.com \
--cc=michael@walle.cc \
--cc=narmstrong@baylibre.com \
--cc=oliver.graute@kococonnector.com \
--cc=pali@kernel.org \
--cc=priyanka.jain@nxp.com \
--cc=rfried.dev@gmail.com \
--cc=sr@denx.de \
--cc=twarren@nvidia.com \
--cc=u-boot-amlogic@groups.io \
--cc=u-boot@lists.denx.de \
--cc=vladimir.oltean@nxp.com \
--cc=wasim.khan@nxp.com \
--cc=yorksun@freescale.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).