From: Olof Johansson <olof@lixom.net>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, paulus@ozlabs.org,
lethal@linux-sh.org, kyle@parisc-linux.org,
grundler@parisc-linux.org
Subject: [PATCH 1/2] bug.h: Introduce HAVE_ARCH_WARN
Date: Thu, 11 Oct 2007 12:12:11 -0500 [thread overview]
Message-ID: <20071011171211.GB10877@lixom.net> (raw)
HAVE_ARCH_WARN is used to determine if an arch already has a __WARN()
macro, or if a generic one is needed.
With this, some of the arch-specific WARN_ON() implementations can be
made common instead (see follow-up patch for powerpc).
Signed-off-by: Olof Johansson <olof@lixom.net>
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index d56fedb..c6b8386 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -31,14 +31,19 @@ struct bug_entry {
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
#endif
+#ifndef HAVE_ARCH_WARN
+#define __WARN() do { \
+ printk("WARNING: at %s:%d %s()\n", __FILE__, \
+ __LINE__, __FUNCTION__); \
+ dump_stack(); \
+} while (0)
+#endif
+
#ifndef HAVE_ARCH_WARN_ON
#define WARN_ON(condition) ({ \
int __ret_warn_on = !!(condition); \
- if (unlikely(__ret_warn_on)) { \
- printk("WARNING: at %s:%d %s()\n", __FILE__, \
- __LINE__, __FUNCTION__); \
- dump_stack(); \
- } \
+ if (unlikely(__ret_warn_on)) \
+ __WARN(); \
unlikely(__ret_warn_on); \
})
#endif
diff --git a/include/asm-parisc/bug.h b/include/asm-parisc/bug.h
index 8cfc553..3f68100 100644
--- a/include/asm-parisc/bug.h
+++ b/include/asm-parisc/bug.h
@@ -8,6 +8,7 @@
#ifdef CONFIG_BUG
#define HAVE_ARCH_BUG
+#define HAVE_ARCH_WARN
#define HAVE_ARCH_WARN_ON
/* the break instruction is used as BUG() marker. */
diff --git a/include/asm-powerpc/bug.h b/include/asm-powerpc/bug.h
index e55d1f6..02e171c 100644
--- a/include/asm-powerpc/bug.h
+++ b/include/asm-powerpc/bug.h
@@ -110,6 +110,7 @@
})
#define HAVE_ARCH_BUG
+#define HAVE_ARCH_WARN
#define HAVE_ARCH_BUG_ON
#define HAVE_ARCH_WARN_ON
#endif /* __ASSEMBLY __ */
diff --git a/include/asm-sh/bug.h b/include/asm-sh/bug.h
index a78d482..4ea415b 100644
--- a/include/asm-sh/bug.h
+++ b/include/asm-sh/bug.h
@@ -5,6 +5,7 @@
#ifdef CONFIG_BUG
#define HAVE_ARCH_BUG
+#define HAVE_ARCH_WARN
#define HAVE_ARCH_WARN_ON
/**
next reply other threads:[~2007-10-11 17:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-11 17:12 Olof Johansson [this message]
2007-10-11 17:14 ` [PATCH 2/2] powerpc: Switch to generic WARN_ON()/BUG_ON() Olof Johansson
2007-10-11 19:55 ` Scott Wood
2007-10-12 1:23 ` Paul Mackerras
2007-10-12 2:04 ` Kyle McMartin
2007-10-12 2:41 ` Olof Johansson
2007-10-12 2:40 ` Olof Johansson
2007-10-19 2:03 ` [PATCH v2] [2/2] " Olof Johansson
2007-10-11 17:20 ` [PATCH 1/2] bug.h: Introduce HAVE_ARCH_WARN Kyle McMartin
2007-10-12 2:53 ` Paul Mundt
2007-10-18 22:17 ` Andrew Morton
2007-10-18 22:34 ` Olof Johansson
2007-10-19 2:03 ` [PATCH v2] [1/2] bug.h: Remove HAVE_ARCH_BUG.* / HAVE_ARCH_WARN.* Olof Johansson
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=20071011171211.GB10877@lixom.net \
--to=olof@lixom.net \
--cc=akpm@linux-foundation.org \
--cc=grundler@parisc-linux.org \
--cc=kyle@parisc-linux.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@ozlabs.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
all inboxes | Powered by JetHome®