summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-12-08 10:11:04 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-12-09 12:57:35 +0100
commit8edb3a0545c0931d6bf59af9d58aa2e7f8c780ac (patch)
tree0df8bd0955b71d5a0dc0c21cd84b3850f6802f05
parent2c670b8f1d426dade00c25f47bfa01267d43cc94 (diff)
downloadbarebox-8edb3a0545c0931d6bf59af9d58aa2e7f8c780ac.tar.gz
barebox-8edb3a0545c0931d6bf59af9d58aa2e7f8c780ac.tar.xz
printf: move panic() to common/misc.c
panic() is not really a printf like function, so move it to common/misc.c. This is done because we want to have printf support in the PBL, but PBL has it's own panic() implementation. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/misc.c22
-rw-r--r--lib/vsprintf.c21
2 files changed, 22 insertions, 21 deletions
diff --git a/common/misc.c b/common/misc.c
index 65f3306bee..6da71c7ab7 100644
--- a/common/misc.c
+++ b/common/misc.c
@@ -22,6 +22,7 @@
#include <magicvar.h>
#include <globalvar.h>
#include <environment.h>
+#include <led.h>
#include <of.h>
int errno;
@@ -188,3 +189,24 @@ EXPORT_SYMBOL(barebox_get_hostname);
BAREBOX_MAGICVAR_NAMED(global_hostname, global.hostname,
"shortname of the board. Also used as hostname for DHCP requests");
+
+void __noreturn panic(const char *fmt, ...)
+{
+ va_list args;
+ va_start(args, fmt);
+ vprintf(fmt, args);
+ putchar('\n');
+ va_end(args);
+
+ dump_stack();
+
+ led_trigger(LED_TRIGGER_PANIC, TRIGGER_ENABLE);
+
+ if (IS_ENABLED(CONFIG_PANIC_HANG)) {
+ hang();
+ } else {
+ udelay(100000); /* allow messages to go out */
+ reset_cpu(0);
+ }
+}
+EXPORT_SYMBOL(panic);
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 512c88247f..a1f95fed26 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -680,24 +680,3 @@ char *asprintf(const char *fmt, ...)
return p;
}
EXPORT_SYMBOL(asprintf);
-
-void __noreturn panic(const char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- vprintf(fmt, args);
- putchar('\n');
- va_end(args);
-
- dump_stack();
-
- led_trigger(LED_TRIGGER_PANIC, TRIGGER_ENABLE);
-
- if (IS_ENABLED(CONFIG_PANIC_HANG)) {
- hang();
- } else {
- udelay(100000); /* allow messages to go out */
- reset_cpu(0);
- }
-}
-EXPORT_SYMBOL(panic);