[U-Boot] [PATCH V2] Fix breakage after removing common.h from export.h

Stefano Babic sbabic at denx.de
Fri Dec 9 11:33:10 CET 2011


commit 0910d0bcb85acdf09b9dfd8ded452367b540a4ad
Mike Partington <mparting at lexmark.com>
Date:   Wed Oct 27 10:31:09 2010 +0000

    Standalone Apps: Standalone apps should need only exports.h.

    Modify exports.h to remove its dependencies on other files, thus
    enabling standalone apps to require only exports.h from the U-Boot
    source tree.  This appears to be the intent based on the following
    note: http://lists.denx.de/pipermail/u-boot/2010-January/067174.html

breaks all boards - the fact is that common.h is not included anymore
by exports.h, and this breaks the build of several file.

Signed-off-by: Stefano Babic <sbabic at denx.de>
CC: Wolfgang Denk <wd at denx.de>
CC: Albert Aribaud <albert.u.boot at aribaud.net>
---

Changes since V1: V1 broken, ignore it

 include/_exports.h |    6 -----
 include/assert.h   |   54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/common.h   |   16 +--------------
 lib/qsort.c        |    2 +
 4 files changed, 57 insertions(+), 21 deletions(-)
 create mode 100644 include/assert.h

diff --git a/include/_exports.h b/include/_exports.h
index 349a3c5..5efcad6 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -24,9 +24,3 @@ EXPORT_FUNC(simple_strtol)
 EXPORT_FUNC(strcmp)
 EXPORT_FUNC(i2c_write)
 EXPORT_FUNC(i2c_read)
-EXPORT_FUNC(spi_init)
-EXPORT_FUNC(spi_setup_slave)
-EXPORT_FUNC(spi_free_slave)
-EXPORT_FUNC(spi_claim_bus)
-EXPORT_FUNC(spi_release_bus)
-EXPORT_FUNC(spi_xfer)
diff --git a/include/assert.h b/include/assert.h
new file mode 100644
index 0000000..3f1160b
--- /dev/null
+++ b/include/assert.h
@@ -0,0 +1,54 @@
+/*
+ * (C) Copyright 2011
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * (C) Copyright 2000-2009
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __ASSERT_H
+#define __ASERT_H
+
+#ifndef _DEBUG
+#ifdef DEBUG
+#define _DEBUG	1
+#else
+#define _DEBUG	0
+#endif
+#endif
+
+/*
+ * An assertion is run-time check done in debug mode only. If DEBUG is not
+ * defined then it is skipped. If DEBUG is defined and the assertion fails,
+ * then it calls panic*( which may or may not reset/halt U-Boot (see
+ * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found
+ * before release, and after release it is hoped that they don't matter. But
+ * in any case these failing assertions cannot be fixed with a reset (which
+ * may just do the same assertion again).
+ */
+void __assert_fail(const char *assertion, const char *file, unsigned line,
+		   const char *function);
+#define assert(x) \
+	({ if (!(x) && _DEBUG) \
+		__assert_fail(#x, __FILE__, __LINE__, __func__); })
+
+
+#endif
diff --git a/include/common.h b/include/common.h
index 05a658c..e265bd4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -35,6 +35,7 @@ typedef volatile unsigned short vu_short;
 typedef volatile unsigned char	vu_char;
 
 #include <config.h>
+#include <assert.h>
 #include <asm-offsets.h>
 #include <linux/bitops.h>
 #include <linux/types.h>
@@ -136,21 +137,6 @@ typedef volatile unsigned char	vu_char;
 #define debug(fmt, args...)			\
 	debug_cond(_DEBUG, fmt, ##args)
 
-/*
- * An assertion is run-time check done in debug mode only. If DEBUG is not
- * defined then it is skipped. If DEBUG is defined and the assertion fails,
- * then it calls panic*( which may or may not reset/halt U-Boot (see
- * CONFIG_PANIC_HANG), It is hoped that all failing assertions are found
- * before release, and after release it is hoped that they don't matter. But
- * in any case these failing assertions cannot be fixed with a reset (which
- * may just do the same assertion again).
- */
-void __assert_fail(const char *assertion, const char *file, unsigned line,
-		   const char *function);
-#define assert(x) \
-	({ if (!(x) && _DEBUG) \
-		__assert_fail(#x, __FILE__, __LINE__, __func__); })
-
 #define error(fmt, args...) do {					\
 		printf("ERROR: " fmt "\nat %s:%d/%s()\n",		\
 			##args, __FILE__, __LINE__, __func__);		\
diff --git a/lib/qsort.c b/lib/qsort.c
index 86c392c..5291c8d 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -16,6 +16,8 @@
  * bcc and gcc. */
 
 #include <linux/types.h>
+#include <stdarg.h>
+#include <assert.h>
 #include <exports.h>
 
 void qsort(void  *base,
-- 
1.7.5.4



More information about the U-Boot mailing list