[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240703124236.6f505329@booty>
Date: Wed, 3 Jul 2024 12:42:36 +0200
From: Luca Ceresoli <luca.ceresoli@...tlin.com>
To: Peng Fan <peng.fan@....com>
Cc: Rob Herring <robh@...nel.org>, "Peng Fan (OSS)" <peng.fan@....nxp.com>,
Saravana Kannan <saravanak@...gle.com>, Michael Turquette
<mturquette@...libre.com>, Stephen Boyd <sboyd@...nel.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>
Subject: Re: [PATCH 1/2] of: property: add of_property_for_each_u64
Hello Peng,
On Fri, 28 Jun 2024 16:16:17 +0200
Luca Ceresoli <luca.ceresoli@...tlin.com> wrote:
[...]
> > > > > +#define of_property_for_each_u64(np, propname, prop, p, u) \
> > > > > + for (prop = of_find_property(np, propname, NULL), \
> > > > > + p = of_prop_next_u64(prop, NULL, &u); \
> > > > > + p; \
> > > > > + p = of_prop_next_u64(prop, p, &u))
> > > >
> > > > I think we want to define this differently to avoid exposing struct
> > > > property and the property data directly. Like this:
> > > >
> > > > #define of_property_for_each_u64(np, propname, u) \
> > > > for (struct property *_prop = of_find_property(np, propname, NULL),
> > > > const __be32 *_p = of_prop_next_u64(_prop, NULL, &u);
> > > > _p;
> > > > _p = of_prop_next_u64(_prop, _p, &u))
> >
> > This will trigger a compilation error, because C not allow
> > declare two variables with different types as for loop expression 1.
> > Need to think about other methods.
>
> I have a working draft here where I solved it somehow, let me just find
> the proper branch and send it. Perhaps next week, but I'm striving to do
> that by Mon-Tue.
Ok, that slipped to Wednesday, but here it is:
https://lore.kernel.org/all/20240703-of_property_for_each_u32-v1-1-42c1fc0b82aa@bootlin.com/
I think you can reuse the technique I used in that patch to write
of_property_for_each_u64(np, propname, u), taking only 3 parameters.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists