Lines Matching full:task

13 int __rxe_do_task(struct rxe_task *task)  in __rxe_do_task()  argument
18 while ((ret = task->func(task->arg)) == 0) in __rxe_do_task()
21 task->ret = ret; in __rxe_do_task()
28 * a second caller finds the task already running
35 struct rxe_task *task = from_tasklet(task, t, tasklet); in rxe_do_task() local
38 spin_lock_bh(&task->state_lock); in rxe_do_task()
39 switch (task->state) { in rxe_do_task()
41 task->state = TASK_STATE_BUSY; in rxe_do_task()
42 spin_unlock_bh(&task->state_lock); in rxe_do_task()
46 task->state = TASK_STATE_ARMED; in rxe_do_task()
49 spin_unlock_bh(&task->state_lock); in rxe_do_task()
53 spin_unlock_bh(&task->state_lock); in rxe_do_task()
54 pr_warn("%s failed with bad state %d\n", __func__, task->state); in rxe_do_task()
60 ret = task->func(task->arg); in rxe_do_task()
62 spin_lock_bh(&task->state_lock); in rxe_do_task()
63 switch (task->state) { in rxe_do_task()
66 task->state = TASK_STATE_START; in rxe_do_task()
73 tasklet_schedule(&task->tasklet); in rxe_do_task()
74 task->state = TASK_STATE_START; in rxe_do_task()
78 /* someone tried to run the task since the last time we called in rxe_do_task()
83 task->state = TASK_STATE_BUSY; in rxe_do_task()
89 task->state); in rxe_do_task()
91 spin_unlock_bh(&task->state_lock); in rxe_do_task()
94 task->ret = ret; in rxe_do_task()
97 int rxe_init_task(struct rxe_task *task, in rxe_init_task() argument
100 task->arg = arg; in rxe_init_task()
101 task->func = func; in rxe_init_task()
102 snprintf(task->name, sizeof(task->name), "%s", name); in rxe_init_task()
103 task->destroyed = false; in rxe_init_task()
105 tasklet_setup(&task->tasklet, rxe_do_task); in rxe_init_task()
107 task->state = TASK_STATE_START; in rxe_init_task()
108 spin_lock_init(&task->state_lock); in rxe_init_task()
113 void rxe_cleanup_task(struct rxe_task *task) in rxe_cleanup_task() argument
118 * Mark the task, then wait for it to finish. It might be in rxe_cleanup_task()
121 task->destroyed = true; in rxe_cleanup_task()
124 spin_lock_bh(&task->state_lock); in rxe_cleanup_task()
125 idle = (task->state == TASK_STATE_START); in rxe_cleanup_task()
126 spin_unlock_bh(&task->state_lock); in rxe_cleanup_task()
129 tasklet_kill(&task->tasklet); in rxe_cleanup_task()
132 void rxe_run_task(struct rxe_task *task, int sched) in rxe_run_task() argument
134 if (task->destroyed) in rxe_run_task()
138 tasklet_schedule(&task->tasklet); in rxe_run_task()
140 rxe_do_task(&task->tasklet); in rxe_run_task()
143 void rxe_disable_task(struct rxe_task *task) in rxe_disable_task() argument
145 tasklet_disable(&task->tasklet); in rxe_disable_task()
148 void rxe_enable_task(struct rxe_task *task) in rxe_enable_task() argument
150 tasklet_enable(&task->tasklet); in rxe_enable_task()