diff options
author | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-12-01 18:45:15 +0000 |
---|---|---|
committer | mattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-12-01 18:45:15 +0000 |
commit | 6d80836f6f3c831d3f81e6f62ac3fab4571bde2f (patch) | |
tree | 8f0d41b9a371c6be468563c3eb4caf90dc5968df /wct4xxp | |
parent | 0acc770c34318f27e2e58f3f99c733399b4d9c37 (diff) |
Fix workqueues for newer kernels
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1685 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'wct4xxp')
-rw-r--r-- | wct4xxp/base.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/wct4xxp/base.c b/wct4xxp/base.c index 72f83c8..54f13dc 100644 --- a/wct4xxp/base.c +++ b/wct4xxp/base.c @@ -35,6 +35,7 @@ #include <linux/interrupt.h> #include <linux/spinlock.h> #include <asm/io.h> +#include <linux/version.h> #ifdef STANDALONE_ZAPATA #include "zaptel.h" #else @@ -94,7 +95,7 @@ #define DEBUG_FRAMER (1 << 6) #ifdef ENABLE_WORKQUEUES -#include <linux/cpumask.h> +#include <linux/cpu.h> /* XXX UGLY!!!! XXX We have to access the direct structures of the workqueue which are only defined within workqueue.c because they don't give us a routine to allow us @@ -133,7 +134,12 @@ struct cpu_workqueue_struct { * per-CPU workqueues: */ struct workqueue_struct { + /* TODO: Find out exactly where the API changed */ +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) + struct cpu_workqueue_struct *cpu_wq; +#else struct cpu_workqueue_struct cpu_wq[NR_CPUS]; +#endif const char *name; struct list_head list; /* Empty if single thread */ }; @@ -162,12 +168,13 @@ static void __t4_queue_work(struct cpu_workqueue_struct *cwq, static inline int t4_queue_work(struct workqueue_struct *wq, struct work_struct *work, int cpu) { int ret = 0; - + get_cpu(); if (!test_and_set_bit(0, &work->pending)) { BUG_ON(!list_empty(&work->entry)); __t4_queue_work(wq->cpu_wq + cpu, work); ret = 1; } + put_cpu(); return ret; } |