aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi/common/src/linux_work.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat/linuxkpi/common/src/linux_work.c')
-rw-r--r--sys/compat/linuxkpi/common/src/linux_work.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_work.c b/sys/compat/linuxkpi/common/src/linux_work.c
index 3831d7a169c3..e01e507c6be8 100644
--- a/sys/compat/linuxkpi/common/src/linux_work.c
+++ b/sys/compat/linuxkpi/common/src/linux_work.c
@@ -220,8 +220,9 @@ linux_work_fn(void *context, int pending)
struct work_struct *work;
struct workqueue_struct *wq;
struct work_exec exec;
+ struct task_struct *task;
- linux_set_current(curthread);
+ task = current;
/* setup local variables */
work = context;
@@ -240,9 +241,15 @@ linux_work_fn(void *context, int pending)
case WORK_ST_CANCEL:
WQ_EXEC_UNLOCK(wq);
+ /* set current work structure */
+ task->work = work;
+
/* call work function */
work->func(work);
+ /* set current work structure */
+ task->work = NULL;
+
WQ_EXEC_LOCK(wq);
/* check if unblocked */
if (exec.target != work) {
@@ -579,6 +586,12 @@ linux_init_delayed_work(struct delayed_work *dwork, work_func_t func)
callout_init_mtx(&dwork->timer.callout, &dwork->timer.mtx, 0);
}
+struct work_struct *
+linux_current_work(void)
+{
+ return (current->work);
+}
+
static void
linux_work_init(void *arg)
{