From: "Jan Beulich" Subject: [PATCH] add generic WARN_ON() Date: Thu, 22 Mar 2007 14:19:43 +0000 Message-ID: <46029E8F.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org The PowerPC and IA64 parts haven't been tested, I hope I didn't break anything there. Signed-off-by: Jan Beulich Index: 2007-03-19/xen/include/asm-ia64/linux-xen/asm/iosapic.h =================================================================== --- 2007-03-19.orig/xen/include/asm-ia64/linux-xen/asm/iosapic.h 2006-07-17 08:27:48.000000000 +0200 +++ 2007-03-19/xen/include/asm-ia64/linux-xen/asm/iosapic.h 2007-03-19 13:17:55.000000000 +0100 @@ -123,11 +123,10 @@ static inline void list_move(struct list #define move_irq(x) -#define WARN_ON(condition) do { \ - if (unlikely((condition)!=0)) { \ - printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ - dump_stack(); \ - } \ +#undef WARN +#define WARN() do { \ + printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \ + dump_stack(); \ } while (0) #ifdef nop Index: 2007-03-19/xen/include/asm-powerpc/debugger.h =================================================================== --- 2007-03-19.orig/xen/include/asm-powerpc/debugger.h 2006-12-15 08:53:49.000000000 +0100 +++ 2007-03-19/xen/include/asm-powerpc/debugger.h 2007-03-19 13:17:55.000000000 +0100 @@ -68,8 +68,8 @@ static inline void unimplemented(void) } extern void __warn(char *file, int line); +#undef WARN #define WARN() __warn(__FILE__, __LINE__) -#define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 ) extern void __attn(void); #define ATTN() __attn(); Index: 2007-03-19/xen/include/xen/lib.h =================================================================== --- 2007-03-19.orig/xen/include/xen/lib.h 2007-02-23 09:42:39.000000000 +0100 +++ 2007-03-19/xen/include/xen/lib.h 2007-03-19 13:17:55.000000000 +0100 @@ -13,6 +13,15 @@ void __bug(char *file, int line) __attri #define BUG_ON(_p) do { if (_p) BUG(); } while ( 0 ) +#ifndef WARN +#define WARN() do { \ + printk("Badness at %s:%d\n", __FILE__, __LINE__); \ + dump_execution_state(); \ +} while (0) +#endif + +#define WARN_ON(_p) do { if (_p) WARN(); } while ( 0 ) + /* Force a compilation error if condition is true */ #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)]))