summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-10-21 19:48:24 +0000
committerShaun Ruffell <sruffell@digium.com>2011-10-21 19:48:24 +0000
commit1e7b5111c913ab559ed346bfc4a311e9cbca0240 (patch)
tree7893ca489e1d5b42072f6f9265b271dbab4642bd
parent3483ee2a6dc11d462506b23ad8f67a55e2db94a2 (diff)
dahdi: Move WARN_ON_ONCE from wctc4xxp driver to include/dahdi/kernel.h
I only generally test on RHEL 4 when testing against kernels older than 2.6.18. Apparently OpenSUSE 10.1 runs with 2.6.16 and doesn't have WARN_ON_ONCE backported. I took the patch Richard Miller originally attached to the issue and moved it to include/dahdi/kernel.h so it would be available for all the board drivers in the future. Internal-Issue-ID: DAHLIN-260 Reported-by: Richard Miller Signed-off-by: Shaun Ruffell <sruffell@digium.com> Origin: http://svnview.digium.com/svn/dahdi?view=rev&rev=10252 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/branches/2.5@10254 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wctc4xxp/base.c14
-rw-r--r--include/dahdi/kernel.h13
2 files changed, 13 insertions, 14 deletions
diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c
index 78bd09a..3bc2cd3 100644
--- a/drivers/dahdi/wctc4xxp/base.c
+++ b/drivers/dahdi/wctc4xxp/base.c
@@ -73,20 +73,6 @@
dev_info(&(wc)->pdev->dev, _fmt, ## _args); \
} \
-#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 LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
/* also added in RHEL kernels with the OpenInfiniband backport: */
#if LINUX_VERSION_CODE != KERNEL_VERSION(2, 6, 9) || !defined(DEFINE_SPINLOCK)
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index 161c7a2..7a2cfe9 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -1364,6 +1364,19 @@ static inline void list_replace(struct list_head *old, struct list_head *new)
new->prev = old->prev;
new->prev->next = new;
}
+
+#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
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
#define kzalloc(a, b) kcalloc(1, a, b)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)