[RFC PATCH] dtc: Add support for named constants

Stephen Warren swarren at nvidia.com
Wed Aug 31 02:37:40 EST 2011


David Gibson wrote at Monday, August 29, 2011 10:23 PM:
> On Tue, Aug 23, 2011 at 04:43:20PM -0600, Stephen Warren wrote:
> > You may define constants as follows:
> >
> > /define/ $TWO 2;
> > /define/ $FOUR 4;
> > /define/ $OTHER $FOUR;
> >
> > And properties may use these values as follows:
> >
> > foo = <1 $TWO 3 $FOUR 5>;
...
> > Note 2: I'd prefer the syntax of /define/ to be:
> >
> > /define/ TWO 2;
> 
> Oh goodness, yes.  The dollar signs are revolting.
> 
> > but I assume that'd cause the lexing for DT_DEFINEREF to conflict with
> > that for DT_LABEL?
> 
> Nope, the final colon should distinguish DT_LABEL.  In dts-v1 C-like
> identifiers should be lexically distinct in most contexts.  This is
> not by accident.  They could be confused with node or property names,
> but that shouldn't cause trouble.

OK, I'll take a stab at that and see.

As background, I found the following thread from 2008:

http://lists.ozlabs.org/pipermail/devicetree-discuss/2008-September/000149.html

... where Jon Loeliger was working on much more extensive new syntax,
and it sounded like you had some patches at least for math expressions
in cells etc. The conversation seemed to die off after a few weeks. Did
anything come of that; is anyone else working on e.g. at least the math
expressions and defines part, even if not the scripting stuff?

I see that a little later, Jon pushed:

http://git.jdl.com/gitweb/?p=dtc.git;a=shortlog;h=refs/heads/testing

I'm mainly asking because if /any/ of that is something that's still
useful to pursue, I might want to align this patch with some of that so
as not to preclude any of that being ported to ToT.

Thanks.

-- 
nvpublic



More information about the devicetree-discuss mailing list