Skip to content

Commit

Permalink
debug: introduce __WARN()
Browse files Browse the repository at this point in the history
Introduce __WARN() in the generic case, so the generic WARN_ON()
can use arch-specific code for when the condition is true.

Signed-off-by: Olof Johansson <olof@lixom.net>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Olof Johansson authored and Ingo Molnar committed Jan 30, 2008
1 parent f315dec commit 3a6a62f
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions include/asm-generic/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@ struct bug_entry {
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
#endif

#ifndef HAVE_ARCH_WARN_ON
#ifndef __WARN
#define __WARN() do { \
printk("WARNING: at %s:%d %s()\n", __FILE__, \
__LINE__, __FUNCTION__); \
dump_stack(); \
} while (0)
#endif

#ifndef 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
Expand Down

0 comments on commit 3a6a62f

Please sign in to comment.