linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/5] bug: Use a common definition of BUG_ON regardless of CONFIG_BUG
Date: Tue, 25 Feb 2014 19:49:19 -0800	[thread overview]
Message-ID: <6ce38c3701f8ed1d30bfc1661ede7eade46a79c6.1393385236.git.josh@joshtriplett.org> (raw)
In-Reply-To: <469b5dc113cb468232291527642f8dc47663e945.1393385236.git.josh@joshtriplett.org>

include/asm-generic/bug.h defines BUG_ON to call BUG() if CONFIG_BUG=y,
or as a no-op if !CONFIG_BUG.  However, BUG() is already a no-op if
!CONFIG_BUG, making this pointless.  Use a common definition that always
calls BUG().

This does not change the compiled code at all.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
 include/asm-generic/bug.h | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index a97fa11..653c44a 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -51,10 +51,6 @@ struct bug_entry {
 } while (0)
 #endif
 
-#ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
-#endif
-
 /*
  * WARN(), WARN_ON(), WARN_ON_ONCE, and so on can be used to report
  * significant issues that need prompt attention if they should ever
@@ -141,10 +137,6 @@ extern void warn_slowpath_null(const char *file, const int line);
 #define BUG() do {} while (0)
 #endif
 
-#ifndef HAVE_ARCH_BUG_ON
-#define BUG_ON(condition) do { if (condition) ; } while (0)
-#endif
-
 #ifndef HAVE_ARCH_WARN_ON
 #define WARN_ON(condition) ({						\
 	int __ret_warn_on = !!(condition);				\
@@ -167,6 +159,10 @@ extern void warn_slowpath_null(const char *file, const int line);
 
 #endif
 
+#ifndef HAVE_ARCH_BUG_ON
+#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0)
+#endif
+
 /*
  * WARN_ON_SMP() is for cases that the warning is either
  * meaningless for !SMP or may even cause failures.
-- 
1.9.0

  parent reply	other threads:[~2014-02-26  3:49 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26  3:48 [PATCH v2 1/5] bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family Josh Triplett
2014-02-26  3:48 ` Josh Triplett
2014-02-26  3:48 ` [PATCH v2 2/5] include/asm-generic/bug.h: Style fix: s/while(0)/while (0)/ Josh Triplett
2014-02-26  3:48   ` Josh Triplett
2014-02-26 13:25   ` Arnd Bergmann
2014-02-26 13:25     ` Arnd Bergmann
2014-02-26  3:49 ` [PATCH v2 3/5] bug: When !CONFIG_BUG, make WARN call no_printk to check format and args Josh Triplett
2014-02-26  3:49   ` Josh Triplett
2014-02-26 13:25   ` Arnd Bergmann
2014-02-26 13:25     ` Arnd Bergmann
2014-02-26  3:49 ` Josh Triplett [this message]
2014-02-26  3:49   ` [PATCH v2 4/5] bug: Use a common definition of BUG_ON regardless of CONFIG_BUG Josh Triplett
2014-02-26 13:26   ` Arnd Bergmann
2014-02-26  3:49 ` [PATCH v2 5/5] bug: Make BUG() call unreachable() Josh Triplett
2014-02-26  3:49   ` Josh Triplett
2014-02-26 13:29   ` Arnd Bergmann
2014-02-26 13:29     ` Arnd Bergmann
2014-02-26 14:58     ` Josh Triplett
2014-02-26 14:58       ` Josh Triplett
2014-02-27 19:19       ` Arnd Bergmann
2014-02-28  0:16         ` Josh Triplett
2014-02-28  8:55           ` Arnd Bergmann
2014-03-10  1:00             ` [PATCH v3 1/5] bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family Josh Triplett
2014-03-10  1:01               ` [PATCH v3 2/5] include/asm-generic/bug.h: Style fix: s/while(0)/while (0)/ Josh Triplett
2014-03-10  1:02               ` [PATCH v3 3/5] bug: When !CONFIG_BUG, make WARN call no_printk to check format and args Josh Triplett
2014-03-10  1:02                 ` Josh Triplett
2014-03-10  1:02               ` [PATCH v3 4/5] bug: Make BUG() always stop the machine Josh Triplett
2014-03-10  1:03               ` [PATCH v3 5/5] x86: Always define BUG() and HAVE_ARCH_BUG, even with !CONFIG_BUG Josh Triplett
2014-03-11 16:40               ` [PATCH v3 1/5] bug: When !CONFIG_BUG, simplify WARN_ON_ONCE and family Arnd Bergmann
2014-03-11 17:49                 ` Josh Triplett
2014-03-11 17:49                   ` Josh Triplett
2014-02-26 13:24 ` [PATCH v2 " Arnd Bergmann

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=6ce38c3701f8ed1d30bfc1661ede7eade46a79c6.1393385236.git.josh@joshtriplett.org \
    --to=josh@joshtriplett.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).