summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2014-02-04 22:19:54 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2014-02-04 22:19:54 +0000
commit700ee040f453939e3174513da07da5c5d62a1d0a (patch)
tree5e2d22855f021f3f21e495438017f0812e2bb30d /sys/dev/pci
parent2b703f67d711bfe0fb8542b65bbff1c9725a4019 (diff)
Add WARN_ONCE.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/drmP.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index 42594d1dd5f..7cdeb084883 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drmP.h,v 1.165 2014/02/02 03:53:05 jsg Exp $ */
+/* $OpenBSD: drmP.h,v 1.166 2014/02/04 22:19:53 kettenis Exp $ */
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*/
@@ -170,6 +170,16 @@ do { \
unlikely(__ret); \
})
+#define WARN_ONCE(condition, fmt...) ({ \
+ static int __warned; \
+ int __ret = !!(condition); \
+ if (__ret && !__warned) { \
+ printf(fmt); \
+ __warned = 1; \
+ } \
+ unlikely(__ret); \
+})
+
#define _WARN_STR(x) #x
#define WARN_ON(condition) ({ \