diff options
author | Shaun Ruffell <sruffell@digium.com> | 2011-10-21 19:32:25 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2011-10-21 19:32:25 +0000 |
commit | 03be073f46b600d403db55fa18e4ce1bb396f68c (patch) | |
tree | 873fd52d9499f62c9eb0f86796825dfe47d4c159 /include | |
parent | d784d303bbc4d1b0cb1d247fc8e1f69c73e5c26f (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>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10252 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r-- | include/dahdi/kernel.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index c392e64..9ae9d1e 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1380,6 +1380,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) |