[zaptel-commits] mattf: trunk r1685 - /trunk/wct4xxp/base.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Fri Dec 1 11:45:16 MST 2006
Author: mattf
Date: Fri Dec 1 12:45:15 2006
New Revision: 1685
URL: http://svn.digium.com/view/zaptel?view=rev&rev=1685
Log:
Fix workqueues for newer kernels
Modified:
trunk/wct4xxp/base.c
Modified: trunk/wct4xxp/base.c
URL: http://svn.digium.com/view/zaptel/trunk/wct4xxp/base.c?view=diff&rev=1685&r1=1684&r2=1685
==============================================================================
--- trunk/wct4xxp/base.c (original)
+++ trunk/wct4xxp/base.c Fri Dec 1 12:45:15 2006
@@ -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 @@
* 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 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;
}
More information about the zaptel-commits
mailing list