libfdt: libfdt_env.h must be included first

David Gibson david at
Fri Sep 28 15:22:25 EST 2007

On Fri, Sep 28, 2007 at 03:13:22PM +1000, Stephen Rothwell wrote:
> On Fri, 28 Sep 2007 14:52:06 +1000 David Gibson <david at> wrote:
> >
> > libfdt.h currently includes fdt.h, then libfdt_env.h.  This is
> > incorrect, because depending on the environment into which libfdt is
> > embedded, libfdt_env.h may be needed to define datatypes used in
> > fdt.h.  This patch corrects the problem.
> So why doesn't fdt.h include libfdt_env.h, then?

Because libfdt_env.h is specifically for libfdt, whereas fdt.h
contains passive structures only, related to the flat tree structure
but without reference to any particular code for handling it.

Basically, fdt.h includes no other headers as a compromise to make it
more easily usable in various contexts.  In fact the only thing it
needs is the C99 fixed-width integer types, but I want it to be also
usable in contexts which don't have a <stdint.h> (e.g. the kernel

David Gibson			| I'll have my music baroque, and my code
david AT	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the Linuxppc-dev mailing list