* [PATCH] Move the fdt*_t type definitions to fdt.h
@ 2013-01-28 2:44 Gerald Van Baren
[not found] ` <5105E615.30102-He//nVnquyzQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Gerald Van Baren @ 2013-01-28 2:44 UTC (permalink / raw)
To: Devicetree Discuss, David Gibson, Jon Loeliger, Kim Phillips
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.
Signed-off-by: Gerald Van Baren <gvb-LFPmMGy0VdYAvxtiuMwx3w@public.gmane.org>
---
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(-)
diff --git a/libfdt/fdt.h b/libfdt/fdt.h
index 45dd134..d7226f0 100644
--- a/libfdt/fdt.h
+++ b/libfdt/fdt.h
@@ -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 */
diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
index c0075e7..0b699a8 100644
--- a/libfdt/libfdt.h
+++ b/libfdt/libfdt.h
@@ -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
diff --git a/libfdt/libfdt_env.h b/libfdt/libfdt_env.h
index 956b4ae..b60e6a7 100644
--- a/libfdt/libfdt_env.h
+++ b/libfdt/libfdt_env.h
@@ -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) | \
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Move the fdt*_t type definitions to fdt.h
[not found] ` <5105E615.30102-He//nVnquyzQT0dZR+AlfA@public.gmane.org>
@ 2013-01-28 4:52 ` David Gibson
[not found] ` <20130128045233.GA4107-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2013-01-28 4:52 UTC (permalink / raw)
To: Gerald Van Baren; +Cc: Devicetree Discuss
[-- Attachment #1.1: Type: text/plain, Size: 972 bytes --]
On Sun, Jan 27, 2013 at 09:44:37PM -0500, Gerald Van Baren wrote:
> 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.
>
> Signed-off-by: Gerald Van Baren <gvb-LFPmMGy0VdYAvxtiuMwx3w@public.gmane.org>
> ---
>
> 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. :-/
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.
--
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
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Move the fdt*_t type definitions to fdt.h
[not found] ` <20130128045233.GA4107-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org>
@ 2013-01-28 13:29 ` Jerry Van Baren
0 siblings, 0 replies; 3+ messages in thread
From: Jerry Van Baren @ 2013-01-28 13:29 UTC (permalink / raw)
To: David Gibson; +Cc: Devicetree Discuss
On 01/27/2013 11:52 PM, David Gibson wrote:
> On Sun, Jan 27, 2013 at 09:44:37PM -0500, Gerald Van Baren wrote:
>> 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.
>>
>> Signed-off-by: Gerald Van Baren <gvb-LFPmMGy0VdYAvxtiuMwx3w@public.gmane.org>
>> ---
>>
>> 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. :-/
>
> 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.
No problem, it didn't feel right to me either. Thank you for your
consideration. :-)
Best regards,
gvb
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-28 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 2:44 [PATCH] Move the fdt*_t type definitions to fdt.h Gerald Van Baren
[not found] ` <5105E615.30102-He//nVnquyzQT0dZR+AlfA@public.gmane.org>
2013-01-28 4:52 ` David Gibson
[not found] ` <20130128045233.GA4107-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org>
2013-01-28 13:29 ` Jerry Van Baren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).