[ofa-general] [PATCH ofed-1.2 1/3] ehca backport 2.6.16
Stefan Roscher
ossrosch at linux.vnet.ibm.com
Fri Mar 9 02:05:42 PST 2007
backport WARN_ON_ONCE macro for 2.6.16
Signed-off-by: Stefan Roscher <stefan.roscher at de.ibm.com>
---
diff -Nurp a/include/asm-generic/bug.h b/include/asm-generic/bug.h
--- a/include/asm-generic/bug.h 1970-01-01 01:00:00.000000000 +0100
+++ b/include/asm-generic/bug.h 2007-03-08 14:56:10.000000000 +0100
@@ -0,0 +1,34 @@
+#ifndef _BACKPORT_ASM_GENERIC_BUG_H
+#define _BACKPORT_ASM_GENERIC_BUG_H
+
+#include_next <asm-generic/bug.h>
+
+#ifdef CONFIG_BUG
+#define WARN_ON_2(condition) ({ \
+ typeof(condition) __ret_warn_on = (condition); \
+ if (unlikely(__ret_warn_on)) { \
+ printk("BUG: at %s:%d %s()\n", __FILE__, \
+ __LINE__, __FUNCTION__); \
+ dump_stack(); \
+ } \
+ unlikely(__ret_warn_on); \
+})
+
+#else /* !CONFIG_BUG */
+
+#define WARN_ON_2(condition) ({ \
+ typeof(condition) __ret_warn_on = (condition); \
+ unlikely(__ret_warn_on); \
+})
+#endif
+#define WARN_ON_ONCE(condition) ({ \
+ static int __warned; \
+ typeof(condition) __ret_warn_once = (condition); \
+ \
+ if (unlikely(__ret_warn_once)) \
+ if (WARN_ON_2(!__warned)) \
+ __warned = 1; \
+ unlikely(__ret_warn_once); \
+})
+
+#endif
More information about the general
mailing list