devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Peng Fan <peng.fan@nxp.com>
Cc: Rob Herring <robh@kernel.org>,
	"Peng Fan (OSS)" <peng.fan@oss.nxp.com>,
	Saravana Kannan <saravanak@google.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>
Subject: Re: [PATCH 1/2] of: property: add of_property_for_each_u64
Date: Wed, 3 Jul 2024 12:42:36 +0200	[thread overview]
Message-ID: <20240703124236.6f505329@booty> (raw)
In-Reply-To: <20240628161617.6bc9ca3c@booty>

Hello Peng,

On Fri, 28 Jun 2024 16:16:17 +0200
Luca Ceresoli <luca.ceresoli@bootlin.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

  reply	other threads:[~2024-07-03 10:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-21 12:36 [PATCH 0/2] clk: add assigned-clock-rates-u64 Peng Fan (OSS)
2024-06-21 12:36 ` [PATCH 1/2] of: property: add of_property_for_each_u64 Peng Fan (OSS)
2024-06-27 21:43   ` Rob Herring
2024-06-28 12:33     ` Peng Fan
2024-06-28 13:10       ` Peng Fan
2024-06-28 14:16         ` Luca Ceresoli
2024-07-03 10:42           ` Luca Ceresoli [this message]
2024-06-21 12:36 ` [PATCH 2/2] clk: clk-conf: support assigned-clock-rates-u64 Peng Fan (OSS)

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=20240703124236.6f505329@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peng.fan@nxp.com \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=sboyd@kernel.org \
    /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 NNTP newsgroup(s).