mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 4/5] include: <asm-generic/bug.h>: make self-contained
Date: Sat, 30 Oct 2021 16:17:38 +0200	[thread overview]
Message-ID: <20211030141739.2207431-4-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20211030141739.2207431-1-a.fatoum@pengutronix.de>

<asm-generic/bug.h> so far depended on a preceding <common.h> to get the
dump_stack() definition. Move dump_stack() to the new printk.h and drop
the remaining puts() use to make header self-contained.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/asm-generic/bug.h |  5 +++--
 include/common.h          |  9 ---------
 include/printk.h          | 10 ++++++++++
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 82b78261fc5d..6aa3eada0ec5 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -2,6 +2,8 @@
 #define _ASM_GENERIC_BUG_H
 
 #include <linux/compiler.h>
+#include <linux/kernel.h>
+#include <printk.h>
 
 #define BUG() do { \
 	printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
@@ -28,8 +30,7 @@
 	int __ret_warn_on = !!(condition);				\
 	if (unlikely(__ret_warn_on)) {					\
 		__WARN();						\
-		puts("WARNING: ");					\
-		printf(format);						\
+		printf("WARNING: " format);				\
 	}								\
 	unlikely(__ret_warn_on);					\
 })
diff --git a/include/common.h b/include/common.h
index 083b76cfedc9..e37630243e73 100644
--- a/include/common.h
+++ b/include/common.h
@@ -62,15 +62,6 @@ void ctrlc_handled(void);
 static inline void ctrlc_handled(void) { }
 #endif
 
-#ifdef CONFIG_ARCH_HAS_STACK_DUMP
-void dump_stack(void);
-#else
-static inline void dump_stack(void)
-{
-	printf("no stack data available\n");
-}
-#endif
-
 int parse_area_spec(const char *str, loff_t *start, loff_t *size);
 
 /* Just like simple_strtoul(), but this one honors a K/M/G suffix */
diff --git a/include/printk.h b/include/printk.h
index 0915efbadd51..baf2cca20213 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -47,4 +47,14 @@ extern void print_hex_dump(const char *level, const char *prefix_str,
 			   int prefix_type, int rowsize, int groupsize,
 			   const void *buf, size_t len, bool ascii);
 
+#ifdef CONFIG_ARCH_HAS_STACK_DUMP
+void dump_stack(void);
+#else
+static inline void dump_stack(void)
+{
+	printf("no stack data available\n");
+}
+#endif
+
+
 #endif
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-10-30 14:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-30 14:17 [PATCH 1/5] include: <linux/bitops.h>: discard left-over hweight code Ahmad Fatoum
2021-10-30 14:17 ` [PATCH 2/5] scripts: <linux/bitops.h>: fix references to undefined __BITS_PER_LONG Ahmad Fatoum
2021-10-30 14:17 ` [PATCH 3/5] include: add dedicated header for printf/printk Ahmad Fatoum
2021-10-30 14:17 ` Ahmad Fatoum [this message]
2021-10-30 14:17 ` [PATCH 5/5] include: move ARRAY_AND_SIZE to <linux/kernel.h> Ahmad Fatoum
2021-11-01  9:08 ` [PATCH 1/5] include: <linux/bitops.h>: discard left-over hweight code Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211030141739.2207431-4-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox