Skip to contentSkip to conversation

common.h: move definitions needed by standalone

RFC/PATCH Chris Packham 1 participant 1 message Jan 16, 2013

lore
Share & tools
lore
#0 lore raw

programs

Standalone applications need to include export.h which in turn needs some of the basic types defined by including common.h. Unfortunately common.h also has declarations for functions not available to standalone applications. For example if a standalone application defined it's own networking stack it could only defined "int net_init(void)" because this is the declaration in net.h which is included in common.h.

To avoid symbol namespace conflicts between standalone applications and u-boot code add the definitions required in exports.h so standalone applications do not have to include common.h.

---
 examples/standalone/hello_world.c |    1 -
 include/common.h                  |   13 +----------
 include/exports.h                 |    2 ++
 include/stddef.h                  |   43
+++++++++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 13 deletions(-)
 create mode 100644 include/stddef.h
(quoted diff) +0 -0

b/examples/standalone/hello_world.c
index 067c390..91a2deb 100644

examples/standalone/hello_world.c +0 -1
@@ -21,7 +21,6 @@
  * MA 02111-1307 USA
  */
 
-#include <common.h>
 #include <exports.h>
 
 int hello_world (int argc, char * const argv[])
include/common.h +1 -12
index a7fb05e..dca33b8 100644
@@ -29,18 +29,7 @@
 
 #ifndef __ASSEMBLY__        /* put C only stuff in this section */
 
-typedef unsigned char        uchar;
-typedef volatile unsigned long    vu_long;
-typedef volatile unsigned short vu_short;
-typedef volatile unsigned char    vu_char;
-
-#include <config.h>
-#include <asm-offsets.h>
-#include <linux/bitops.h>
-#include <linux/types.h>
-#include <linux/string.h>
-#include <asm/ptrace.h>
-#include <stdarg.h>
+#include <stddef.h>
 #if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000)=

)
#include <pci.h>
#endif

include/exports.h +2 -0
index 63aa4b2..d874235 100644
@@ -3,6 +3,8 @@
 
 #ifndef __ASSEMBLY__
 
+#include <stddef.h>
+
 /* These are declarations of exported functions available in C code */
 unsigned long get_version(void);
 int  getc(void);
include/stddef.h new file +43 -0

43 lines not on this page · raw message

--=20
1.7.10.2.dirty

--e89a8ff1c170157ade04d36d59a4--