public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Scott Wood <scottwood@freescale.com>,
	Michal Marek <mmarek@suse.cz>,
	devicetree-discuss@lists.ozlabs.org,
	Stephen Warren <swarren@nvidia.com>,
	linux-kernel@vger.kernel.org
Subject: Re: dtc: import latest upstream dtc
Date: Fri, 12 Oct 2012 11:24:43 -0600	[thread overview]
Message-ID: <5078525B.9030008@wwwdotorg.org> (raw)
In-Reply-To: <20121010231835.GH28467@truffula.fritz.box>

On 10/10/2012 05:18 PM, David Gibson wrote:
...
> And as stated elsewhere, cpp should be invoked with similar options to
> the way it's done for asm files.  A -D__DTS__ or something like that
> would probably be a good idea too, just in case some .h needs to be
> conditional on that.

Hmm. There are some problems here.

Right now, the command I proposed is basically:

$(CPP) -x c $< | dtc ...

Without "-x c", $(CPP) doesn't recognise the file extension of the input
file, and defaults to assuming it's a linker script rather than an input
file, even in pre-processing mode (CPP == $(CC) -E), which obviously
doesn't work too well.

I chose "-x c" because *.dts syntax is closest to C.

However, related to your request above, "-x assembler" might be more
appropriate, since this would presumably define __ASSEMBLY__, which is
what the kernel headers currently use to determine whether to compile
out anything other than #defines. However, executing $(CPP) -x assembler
foo.dts yields a completely empty output! I'm not sure why that is yet.

I also tried passing to $(CPP) the exact same options that the kernel
uses for compiling true assembly files, namely $(a_flags). Doing so
would presumably provide complete compatibility in the pre-defined
#defines between compiling *.S and *.dtsp, which would reduce the
likelihood of needing to do anything different in *.h to support usage
by both *.S and *.dtsp. (Note that I still need to pass a -x option, and
the issue I described above still applies here too). This doesn't work
out, because on ARM you get arch/arm/include/asm/unified.h
force-included, which emits true assembly macros into the output, which
obviously dtc can't parse. This could be avoided by editing that file to
add #ifndef __DTS__ around the offending parts (and passing -D__DTS__ to
$(CPP)), and that does appear to currently be the only file requiring a
change. I wonder if using $(a_flags) is inviting more issues like this
in the future though?

Given this, I'm not convinced we should try to make $(CPP) usage for
*.dts too much like its usage for *.S. I agree it'd probably make sense
to add -D__DTS__ to the command-line, but switching away from -x c or to
using $(a_flags) seems like it'd increase the maintenance requirements
rather than reduce them.

  reply	other threads:[~2012-10-12 17:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 21:25 [PATCH] dtc: import latest upstream dtc Stephen Warren
2012-09-29 21:06 ` Jon Loeliger
2012-10-01 16:09 ` Rob Herring
2012-10-01 16:13   ` Stephen Warren
2012-10-01 17:56     ` Rob Herring
2012-10-01 18:33       ` Stephen Warren
2012-10-01 18:39         ` Jon Loeliger
2012-10-09 21:16           ` Stephen Warren
2012-10-09 23:20             ` Mitch Bradley
2012-10-10  0:04               ` Scott Wood
2012-10-10  4:43                 ` Warner Losh
2012-10-10  7:24                   ` David Gibson
2012-10-10 14:41                     ` Warner Losh
2012-10-10 23:06                       ` David Gibson
2012-10-10 15:16                     ` Stephen Warren
2012-10-10 15:33                       ` Rob Herring
2012-10-10 16:19                         ` Stephen Warren
2012-10-10 17:18                           ` Rob Herring
2012-10-10 18:42                             ` Stephen Warren
2012-10-10 23:16                         ` David Gibson
2012-10-11  1:42                           ` Mitch Bradley
2012-10-11  5:11                             ` David Gibson
2012-10-10 23:09                       ` David Gibson
2012-10-10 15:15                 ` Stephen Warren
2012-10-10 16:09                   ` Scott Wood
2012-10-10 16:22                     ` Stephen Warren
2012-10-10 23:18                       ` David Gibson
2012-10-12 17:24                         ` Stephen Warren [this message]
2012-10-13  6:24                           ` David Gibson
2012-10-13 13:42                             ` Segher Boessenkool
2012-10-14  0:16                               ` David Gibson
2012-10-10 17:09             ` Rob Herring
2012-10-10 18:23               ` Mitch Bradley
2012-10-10 18:45                 ` Stephen Warren
2012-10-10 18:56                   ` Mitch Bradley
2012-10-11  0:14                     ` David Gibson
2012-10-10 23:54                   ` David Gibson
2012-10-10 18:40               ` Stephen Warren
2012-10-10 18:52                 ` Mitch Bradley
2012-10-01 18:02   ` Jon Loeliger

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=5078525B.9030008@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=scottwood@freescale.com \
    --cc=swarren@nvidia.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