diff options
author | Shaun Ruffell <sruffell@digium.com> | 2010-02-08 22:49:32 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2010-02-08 22:49:32 +0000 |
commit | 42e275be0f7ce08a9fe2adf4815f7fd926a341bb (patch) | |
tree | 7aa554e74ca4bf83805d382073efc91967f27f6c /include | |
parent | 791a3df5afe66a8cbe15ebe030c2956fd2e00818 (diff) |
vpmadt032,wcte12xp: Use a timeout on the read/write commands and during load.
It is possible for poorly behaving hardware (and driver bugs) to lockup the
modprobe process by having it wait indefinitely for a command to complete that
never will. DAHDI-451.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8003 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'include')
-rw-r--r-- | include/dahdi/kernel.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h index 129e9b4..96c4076 100644 --- a/include/dahdi/kernel.h +++ b/include/dahdi/kernel.h @@ -1174,10 +1174,8 @@ static inline short dahdi_txtone_nextsample(struct dahdi_chan *ss) /*! Maximum audio mask */ #define DAHDI_FORMAT_AUDIO_MASK ((1 << 16) - 1) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) -#define kzalloc(a, b) kcalloc(1, a, b) -#endif - +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 31) +#define KERN_CONT "" #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) static inline void list_replace(struct list_head *old, struct list_head *new) { @@ -1186,7 +1184,25 @@ static inline void list_replace(struct list_head *old, struct list_head *new) new->prev = old->prev; new->prev->next = new; } -#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, 11) +static inline unsigned long +wait_for_completion_timeout(struct completion *x, unsigned long timeout) +{ + /* There is a race condition here. If x->done is reset to 0 + * before the call to wait_for_completion after this thread wakes. + */ + timeout = wait_event_timeout(x->wait, x->done, timeout); + if (timeout) + wait_for_completion(x); + + return timeout; +} +#endif /* 2.6.11 */ +#endif /* 2.6.14 */ +#endif /* 2.6.18 */ +#endif /* 2.6.31 */ #ifndef DMA_BIT_MASK #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) |