[RFC PATCH] dtc: Add support for named constants

Paul Walmsley paul at pwsan.com
Wed Aug 31 07:04:08 EST 2011


Hi,

On Tue, 30 Aug 2011, Stephen Warren wrote:

> 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;

Some preprocessing support would be very useful for us on OMAP, where we 
have some register bitfields that we'd like to use symbolic names for.

One question, though.  Documentation/devicetree/booting-without-of.txt[1] 
says:

   It is also suggested that you pipe your source file through cpp (gcc
   preprocessor) so you can use #include's, #define for constants, 
   etc...

Is it no longer recommended to use cpp for this purpose?


- Paul

1. http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/devicetree/booting-without-of.txt;h=7c1329de0596a34ce81d60f214d46a43933f05c0;hb=HEAD#l1119



More information about the devicetree-discuss mailing list