libfdt: Use endian.h instead of asm/byteorder.h
PATCH 1/1 libfdt: Use endian.h instead of asm/byteorder.h
Using asm/byteorder.h directly is strongly discouraged since it is a private kernel header.
Signed-off-by Gerald Van Baren <[email protected]>
--- include/libfdt_env.h | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-)
include/libfdt_env.h +11 -4
@@ -33,10 +33,17 @@#include <asm/byteorder.h> 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 /* * Types for `void *' pointers.
Signature · 1 line
1.5.6.5