summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-05 09:49:25 +1000
committerBen Skeggs <bskeggs@redhat.com>2014-08-10 04:43:19 +1000
commit591972d11879c784f201bf81d5580e61d4119fcf (patch)
tree228796fa4850d92cd00da1091e0c7b9f69b88152 /lib
parent3ee679226b75d0706ce218815baa209ef9a63b8e (diff)
downloadnouveau-591972d11879c784f201bf81d5580e61d4119fcf.tar.gz
lib: fix WARN_ON() macros
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/core/os.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/core/os.h b/lib/core/os.h
index 8bcc657b1..3fed174db 100644
--- a/lib/core/os.h
+++ b/lib/core/os.h
@@ -427,7 +427,22 @@ nvos_backtrace(void)
nvos_backtrace(); \
} while(0)
-#define WARN_ON(c) (c)
+#define WARN_ON(c) ({ \
+ int _ret = !!(c); \
+ if (_ret) \
+ WARN(); \
+ _ret; \
+})
+
+#define WARN_ON_ONCE(c) ({ \
+ static int _once = 1; \
+ int _ret = !!(c); \
+ if (_ret && _once) { \
+ WARN(); \
+ _once = 0; \
+ } \
+ _ret; \
+})
/******************************************************************************
* interrupts