Move the fdt*_t type definitions to fdt.h
PATCH 1/1 Move the fdt*_t type definitions to fdt.h
Arguably they belong there since they are fundamental to the fdt. As a side effect, I had to flip the order of #includes of fdt.h and libfdt_env.h in libfdt.h since libfdt_env.h needs the fdt*_t definitions.
---
I'm not sure I like this, but submit it for your consideration. If, for some reason, libfdt_env.h needed to (re)define something in fdt.h, it would be unable to do so. :-/
libfdt/fdt.h | 14 ++++++++++++++ libfdt/libfdt.h | 2 +- libfdt/libfdt_env.h | 13 ------------- 3 files changed, 15 insertions(+), 14 deletions(-)
libfdt/fdt.h +14 -0
@@ -3,6 +3,20 @@ #ifndef __ASSEMBLY__ +#include <stdint.h> + +#ifdef __CHECKER__ +#define __force __attribute__((force)) +#define __bitwise __attribute__((bitwise)) +#else +#define __force +#define __bitwise +#endif + +typedef uint16_t __bitwise fdt16_t; +typedef uint32_t __bitwise fdt32_t; +typedef uint64_t __bitwise fdt64_t; + struct fdt_header { fdt32_t magic; /* magic word FDT_MAGIC */ fdt32_t totalsize; /* total size of DT block */
libfdt/libfdt.h +1 -1
@@ -51,8 +51,8 @@* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <libfdt_env.h> #include <fdt.h> +#include <libfdt_env.h> #define FDT_FIRST_SUPPORTED_VERSION 0x10#define FDT_LAST_SUPPORTED_VERSION 0x11
libfdt/libfdt_env.h +0 -13
@@ -2,21 +2,8 @@#define _LIBFDT_ENV_H#include <stddef.h> -#include <stdint.h> #include <string.h> -#ifdef __CHECKER__ -#define __force __attribute__((force)) -#define __bitwise __attribute__((bitwise)) -#else -#define __force -#define __bitwise -#endif - -typedef uint16_t __bitwise fdt16_t ; -typedef uint32_t __bitwise fdt32_t ; -typedef uint64_t __bitwise fdt64_t ; -#define EXTRACT_BYTE (x, n) ((unsigned long long)((uint8_t *)&x)[n])#define CPU_TO_FDT16 (x) ((EXTRACT_BYTE(x, 0) << 8) | EXTRACT_BYTE(x, 1))#define CPU_TO_FDT32 (x) ((EXTRACT_BYTE(x, 0) << 24) | (EXTRACT_BYTE(x,
1) << 16) | \
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): 5105E615.30102-He//[email protected]
Quoted 10 lines · Gerald Van Baren
Arguably they belong there since they are fundamental to the fdt. As a side effect, I had to flip the order of #includes of
fdt.handlibfdt_env.hinlibfdt.hsincelibfdt_env.hneeds the fdt*_t definitions.Signed-off-by Gerald Van Baren <[email protected]>---
I'm not sure I like this, but submit it for your consideration. If, for some reason,
libfdt_env.hneeded to (re)define something infdt.h, it would be unable to do so. :-/
Sorry, nack on this one. fdt.h is supposed to be as independent as we can make it from the environment in which its being compiled. That means I don't want it to include *any* system headers, even stdint.h.
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
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss
A message that is not in the archive (sent off-list or not yet received): 20130128045233.GA4107-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org
Quoted 8 lines · David Gibson
Quoted 7 lines · Gerald Van Baren
Arguably they belong there since they are fundamental to the fdt. As a side effect, I had to flip the order of #includes of
fdt.handlibfdt_env.hinlibfdt.hsincelibfdt_env.hneeds the fdt*_t definitions.Signed-off-by Gerald Van Baren <[email protected]>---
Quoted 7 lines
Quoted 3 lines
I'm not sure I like this, but submit it for your consideration. If, for some reason,
libfdt_env.hneeded to (re)define something infdt.h, it would be unable to do so. :-/Sorry, nack on this one.
fdt.his supposed to be as independent as we can make it from the environment in which its being compiled. That means I don't want it to include *any* system headers, evenstdint.h.
No problem, it didn't feel right to me either. Thank you for your consideration. :-)
Best regards,
gvb