From patchwork Fri Dec 4 22:27:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sjoerd Simons X-Patchwork-Id: 57728 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp830063lbb; Fri, 4 Dec 2015 14:28:02 -0800 (PST) X-Received: by 10.28.134.199 with SMTP id i190mr7526776wmd.33.1449268075141; Fri, 04 Dec 2015 14:27:55 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id w5si21310035wjq.108.2015.12.04.14.27.54; Fri, 04 Dec 2015 14:27:55 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2A24A4B67B; Fri, 4 Dec 2015 23:27:54 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oVffm-DqSodJ; Fri, 4 Dec 2015 23:27:53 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 337184B65A; Fri, 4 Dec 2015 23:27:53 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5B5984B65A for ; Fri, 4 Dec 2015 23:27:49 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gMl4OLsz624M for ; Fri, 4 Dec 2015 23:27:49 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by theia.denx.de (Postfix) with ESMTPS id 1F4F24B656 for ; Fri, 4 Dec 2015 23:27:45 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sjoerd) with ESMTPSA id 426BF2611FA Received: by dusk.luon.net (Postfix, from userid 1000) id 098E5204A1; Fri, 4 Dec 2015 23:27:42 +0100 (CET) From: Sjoerd Simons To: Simon Glass Date: Fri, 4 Dec 2015 23:27:38 +0100 Message-Id: <1449268061-805-5-git-send-email-sjoerd.simons@collabora.co.uk> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1449268061-805-1-git-send-email-sjoerd.simons@collabora.co.uk> References: <1449268061-805-1-git-send-email-sjoerd.simons@collabora.co.uk> Cc: u-boot@lists.denx.de, Przemyslaw Marczak , Scott Wood , Julius Werner , Stefan Roese Subject: [U-Boot] [PATCH 4/7] lib: Split panic functions out of vsprintf.c X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" To allow panic and panic_str to still be used when using tiny-printf, split them out into their own file which gets build regardless of what printf implementation is used. Signed-off-by: Sjoerd Simons --- lib/Makefile | 6 +++--- lib/panic.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ lib/vsprintf.c | 29 ----------------------------- 3 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 lib/panic.c -- 2.6.2 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/lib/Makefile b/lib/Makefile index 1f1ff6f..ae84833 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -85,13 +85,13 @@ obj-$(CONFIG_LIB_RAND) += rand.o ifdef CONFIG_SPL_BUILD # SPL U-Boot may use full-printf, tiny-printf or none at all ifdef CONFIG_USE_TINY_PRINTF -obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o +obj-$(CONFIG_SPL_SERIAL_SUPPORT) += tiny-printf.o panic.o else -obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o +obj-$(CONFIG_SPL_SERIAL_SUPPORT) += vsprintf.o panic.o endif else # Main U-Boot always uses the full printf support -obj-y += vsprintf.o +obj-y += vsprintf.o panic.o endif subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2 diff --git a/lib/panic.c b/lib/panic.c new file mode 100644 index 0000000..e2b8b74 --- /dev/null +++ b/lib/panic.c @@ -0,0 +1,45 @@ +/* + * linux/lib/vsprintf.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */ +/* + * Wirzenius wrote this portably, Torvalds fucked it up :-) + */ + +#include +#if !defined(CONFIG_PANIC_HANG) +#include +#endif + +static void panic_finish(void) __attribute__ ((noreturn)); + +static void panic_finish(void) +{ + putc('\n'); +#if defined(CONFIG_PANIC_HANG) + hang(); +#else + udelay(100000); /* allow messages to go out */ + do_reset(NULL, 0, 0, NULL); +#endif + while (1) + ; +} + +void panic_str(const char *str) +{ + puts(str); + panic_finish(); +} + +void panic(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vprintf(fmt, args); + va_end(args); + panic_finish(); +} diff --git a/lib/vsprintf.c b/lib/vsprintf.c index dd8380b..bf5fd01 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -897,35 +897,6 @@ int vprintf(const char *fmt, va_list args) return i; } -static void panic_finish(void) __attribute__ ((noreturn)); - -static void panic_finish(void) -{ - putc('\n'); -#if defined(CONFIG_PANIC_HANG) - hang(); -#else - udelay(100000); /* allow messages to go out */ - do_reset(NULL, 0, 0, NULL); -#endif - while (1) - ; -} - -void panic_str(const char *str) -{ - puts(str); - panic_finish(); -} - -void panic(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - vprintf(fmt, args); - va_end(args); - panic_finish(); -} void __assert_fail(const char *assertion, const char *file, unsigned line, const char *function)