Skip to contentSkip to conversation

add generic WARN_ON()

PATCH New Jan Beulich 1 participant 1 message Mar 22, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add generic WARN_ON()

The PowerPC and IA64 parts haven't been tested, I hope I didn't break anything there.

xen/include/asm-ia64/linux-xen/asm/iosapic.h +4 -5
Index: 2007-03-19/xen/include/asm-ia64/linux-xen/asm/iosapic.h
===================================================================
@@ -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
xen/include/asm-powerpc/debugger.h +1 -1
Index: 2007-03-19/xen/include/asm-powerpc/debugger.h
===================================================================
@@ -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();
xen/include/xen/lib.h +9 -0
Index: 2007-03-19/xen/include/xen/lib.h
===================================================================
@@ -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)]))