
Dear Jerry Van Baren,
In message 20081020031023.GA18173@cideas.com you wrote:
... In file included from /home/wd/git/u-boot/include/libfdt_env.h:33, from fdt.c:51: /usr/include/asm/byteorder.h:6:2: warning: #warning using private kernel header; include <endian.h> instead!
...
Does this work better?
Not really:
From 0d33fb368acac6f88c0940ff2d1c77856900abcd Mon Sep 17 00:00:00 2001 From: Gerald Van Baren vanbaren@cideas.com Date: Sun, 19 Oct 2008 22:50:07 -0400 Subject: [PATCH] libfdt: Use endian.h instead of asm/byteorder.h
Using asm/byteorder.h directly is strongly discouraged since it is a private kernel header.
Hm... but you still use it?
Signed-off-by: Gerald Van Baren vanbaren@cideas.com
include/libfdt_env.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/include/libfdt_env.h b/include/libfdt_env.h index 671c3a8..728a248 100644 --- a/include/libfdt_env.h +++ b/include/libfdt_env.h @@ -33,10 +33,17 @@ #include <asm/byteorder.h>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This has not changed?
extern struct fdt_header *working_fdt; /* Pointer to the working fdt */
-#define fdt32_to_cpu(x) __be32_to_cpu(x) -#define cpu_to_fdt32(x) __cpu_to_be32(x) -#define fdt64_to_cpu(x) __be64_to_cpu(x) -#define cpu_to_fdt64(x) __cpu_to_be64(x) +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define fdt32_to_cpu(x) __swab32(x) +#define cpu_to_fdt32(x) __swab32(x) +#define fdt64_to_cpu(x) __swab64(x) +#define cpu_to_fdt64(x) __swab64(x) +#else +#define fdt32_to_cpu(x) (x) +#define cpu_to_fdt32(x) (x) +#define fdt64_to_cpu(x) (x) +#define cpu_to_fdt64(x) (x) +#endif
If I change the code to include <asm/byteorder.h> only for the U-Boot code but use <endian.h>, I get warnings:
../include/libfdt.h:162: warning: implicit declaration of function '__swab32'
and finally a "undefined reference to `__swab32'" error. Seems __swab32 and __swab64 are defined only in linux/byteorder/swab.h
Best regards,
Wolfgang Denk