File dahdi-warn-on-once.diff of Package dahdi-linux
From: Jan Engelhardt <jengelh@medozas.de>
Date: 2011-10-17 21:16:28.811145336 +0200
Upstream: if you can get past the Asterisk Contributor Agreement for this GPL-only piece...
WARN_ON_ONCE was absent from wctdm24xxp.
---
drivers/dahdi/wctdm24xxp/base.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Index: b/drivers/dahdi/wctdm24xxp/base.c
===================================================================
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -83,6 +83,20 @@ Tx Gain - W/Pre-Emphasis: -23.99 to 0.00
#include "voicebus/GpakCust.h"
#include "voicebus/GpakApi.h"
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
+#ifndef WARN_ON_ONCE
+#define WARN_ON_ONCE(__condition) do { \
+ static int __once = 1; \
+ if (unlikely(__condition)) { \
+ if (__once) { \
+ __once = 0; \
+ WARN_ON(0); \
+ } \
+ } \
+} while (0)
+#endif
+#endif
+
#if VOICEBUS_SFRAME_SIZE != SFRAME_SIZE
#error SFRAME_SIZE must match the VOICEBUS_SFRAME_SIZE
#endif