[dahdi-commits] fjoe: freebsd/trunk r10604 - in /freebsd/trunk: bsd-kmod/dahdi/ include/linux/
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Mar 28 12:55:47 CDT 2012
Author: fjoe
Date: Wed Mar 28 12:55:43 2012
New Revision: 10604
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10604
Log:
- Allow kref_put() with spinlocks held (call release via taskqueue).
- wait_queue_head_t is now typedef'ed to a struct so that type checks work
- Use taskqueue_enqueue_fast() with taskqueue_fast.
Modified:
freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c
freebsd/trunk/include/linux/kref.h
freebsd/trunk/include/linux/wait.h
Modified: freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c?view=diff&rev=10604&r1=10603&r2=10604
==============================================================================
--- freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c (original)
+++ freebsd/trunk/bsd-kmod/dahdi/bsd-compat.c Wed Mar 28 12:55:43 2012
@@ -76,7 +76,7 @@
void
tasklet_hi_schedule(struct tasklet_struct *t)
{
- taskqueue_enqueue(taskqueue_fast, &t->task);
+ taskqueue_enqueue_fast(taskqueue_fast, &t->task);
}
void
@@ -311,7 +311,7 @@
schedule_work(struct work_struct *work)
{
work->tq = taskqueue_fast;
- taskqueue_enqueue(taskqueue_fast, &work->task);
+ taskqueue_enqueue_fast(taskqueue_fast, &work->task);
}
void
@@ -364,16 +364,22 @@
/* nothing to do */
}
-void
-flush_workqueue(struct workqueue_struct *wq)
+static void
+_flush_taskqueue(struct taskqueue **tq)
{
struct task flushtask;
PHOLD(curproc);
TASK_INIT(&flushtask, 0, _flush_workqueue_fn, NULL);
- taskqueue_enqueue(wq->tq, &flushtask);
- taskqueue_drain(wq->tq, &flushtask);
+ taskqueue_enqueue_fast(*tq, &flushtask);
+ taskqueue_drain(*tq, &flushtask);
PRELE(curproc);
+}
+
+void
+flush_workqueue(struct workqueue_struct *wq)
+{
+ _flush_taskqueue(&wq->tq);
}
void
@@ -384,6 +390,12 @@
}
/*
+ * Drain taskqueue_fast (schedule_work() requests, including kref release requests)
+ */
+SYSUNINIT(dahdi_bsd_compat_sysuninit, SI_SUB_KLD, SI_ORDER_ANY,
+ _flush_taskqueue, &taskqueue_fast);
+
+/*
* kref API
*/
void
@@ -408,7 +420,8 @@
kref_put(struct kref *kref, void (*release) (struct kref *kref))
{
if (refcount_release(&kref->refcount)) {
- release(kref);
+ INIT_WORK(&kref->release_work, (work_func_t) release);
+ schedule_work(&kref->release_work);
return 1;
}
@@ -615,4 +628,3 @@
0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330,
0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78
};
-
Modified: freebsd/trunk/include/linux/kref.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/kref.h?view=diff&rev=10604&r1=10603&r2=10604
==============================================================================
--- freebsd/trunk/include/linux/kref.h (original)
+++ freebsd/trunk/include/linux/kref.h Wed Mar 28 12:55:43 2012
@@ -2,8 +2,10 @@
#define _LINUX_KREF_H_
#include <linux/types.h>
+#include <linux/workqueue.h>
struct kref {
+ struct work_struct release_work; /* should be the first elem */
volatile u_int refcount;
};
Modified: freebsd/trunk/include/linux/wait.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/linux/wait.h?view=diff&rev=10604&r1=10603&r2=10604
==============================================================================
--- freebsd/trunk/include/linux/wait.h (original)
+++ freebsd/trunk/include/linux/wait.h Wed Mar 28 12:55:43 2012
@@ -3,11 +3,35 @@
#include <linux/spinlock.h>
-typedef void *wait_queue_head_t;
-#define init_waitqueue_head(q)
-#define wake_up(q) wakeup_one(q)
-#define wake_up_interruptible(q) wakeup_one(q)
-#define wake_up_interruptible_all(q) wakeup(q)
+struct __wait_queue_head {
+ void *dummy;
+};
+typedef struct __wait_queue_head wait_queue_head_t;
+
+static inline void
+init_waitqueue_head(wait_queue_head_t *q)
+{
+ // nothing to do
+}
+
+static inline void
+wake_up(wait_queue_head_t *q)
+{
+ wakeup_one(q);
+}
+
+static inline void
+wake_up_interruptible(wait_queue_head_t *q)
+{
+ wakeup_one(q);
+}
+
+static inline void
+wake_up_interruptible_all(wait_queue_head_t *q)
+{
+ wakeup(q);
+}
+
#define wait_event_timeout(q, condition, timeout) \
({ \
int __ret = timeout; \
More information about the dahdi-commits
mailing list