• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/net/irda/

Lines Matching refs:task

55 static void __irda_task_delete(struct irda_task *task);
179 void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state)
183 task->state = state;
187 static void __irda_task_delete(struct irda_task *task)
189 del_timer(&task->timer);
191 kfree(task);
194 void irda_task_delete(struct irda_task *task)
196 /* Unregister task */
197 hashbin_remove(tasks, (long) task, NULL);
199 __irda_task_delete(task);
204 * Function irda_task_kick (task)
206 * Tries to execute a task possible multiple times until the task is either
207 * finished, or askes for a timeout. When a task is finished, we do post
208 * processing, and notify the parent task, that is waiting for this task
211 static int irda_task_kick(struct irda_task *task)
219 IRDA_ASSERT(task != NULL, return -1;);
220 IRDA_ASSERT(task->magic == IRDA_TASK_MAGIC, return -1;);
222 /* Execute task until it's finished, or askes for a timeout */
224 timeout = task->function(task);
226 IRDA_ERROR("%s: error in task handler!\n",
228 irda_task_delete(task);
231 } while ((timeout == 0) && (task->state != IRDA_TASK_DONE));
234 IRDA_ERROR("%s: Error executing task!\n", __FUNCTION__);
235 irda_task_delete(task);
240 if (task->state == IRDA_TASK_DONE) {
241 del_timer(&task->timer);
244 if (task->finished)
245 task->finished(task);
248 if (task->parent) {
250 if (task->parent->state == IRDA_TASK_CHILD_WAIT) {
251 task->parent->state = IRDA_TASK_CHILD_DONE;
254 del_timer(&task->parent->timer);
256 /* Kick parent task */
257 irda_task_kick(task->parent);
260 irda_task_delete(task);
262 irda_start_timer(&task->timer, timeout, (void *) task,
282 * o Make sure you irda_task_delete(task); in case you delete the
285 * want to lock within the task handler.
293 struct irda_task *task;
297 task = kmalloc(sizeof(struct irda_task), GFP_ATOMIC);
298 if (!task)
301 task->state = IRDA_TASK_INIT;
302 task->instance = instance;
303 task->function = function;
304 task->finished = finished;
305 task->parent = parent;
306 task->param = param;
307 task->magic = IRDA_TASK_MAGIC;
309 init_timer(&task->timer);
311 /* Register task */
312 hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL);
315 return irda_task_kick(task) ? NULL : task;
322 * Task time has expired. We now try to execute task (again), and restart
323 * the timer if the task has not finished yet
327 struct irda_task *task;
331 task = (struct irda_task *) data;
333 irda_task_kick(task);