linux/kernel.h: Add WARN_ONCE()
authorFrançois Tigeot <ftigeot@wolfpond.org>
Wed, 6 Aug 2014 13:29:37 +0000 (15:29 +0200)
committerFrançois Tigeot <ftigeot@wolfpond.org>
Wed, 6 Aug 2014 13:36:50 +0000 (15:36 +0200)
sys/dev/drm/include/linux/kernel.h

index 9e36a4a..f3da0bc 100644 (file)
 })
 #endif
 
+#define WARN_ONCE(condition, format...)        ({      \
+       static bool __warned_once;              \
+                                               \
+       if ((condition) && !__warned_once) {    \
+               WARN(condition, format);        \
+               __warned_once = true;           \
+       }                                       \
+})
+
 #define container_of(ptr, type, member)                                \
 ({                                                             \
        __typeof(((type *)0)->member) *_p = (ptr);              \