libfdt: libfdt_env.h must be included first
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.
libfdt/libfdt.h +1 -1
@@ -51,8 +51,8 @@* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <fdt.h> #include <libfdt_env.h> +#include <fdt.h> #define FDT_FIRST_SUPPORTED_VERSION 0x10#define FDT_LAST_SUPPORTED_VERSION 0x11
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 5 lines · On Fri, 28 Sep 2007 14:52:06 +1000 David Gibson <[email protected]>…
libfdt.hcurrently includesfdt.h, thenlibfdt_env.h. This is incorrect, because depending on the environment into which libfdt is embedded,libfdt_env.hmay be needed to define datatypes used infdt.h. This patch corrects the problem.
So why doesn't fdt.h include libfdt_env.h, then?
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Quoted 8 lines · Stephen Rothwell
Quoted 5 lines · On Fri, 28 Sep 2007 14:52:06 +1000 David Gibson <[email protected]>…
libfdt.hcurrently includesfdt.h, thenlibfdt_env.h. This is incorrect, because depending on the environment into which libfdt is embedded,libfdt_env.hmay be needed to define datatypes used infdt.h. This patch corrects the problem.So why doesn't
fdt.hincludelibfdt_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 bootwrapper).
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson