Home | History | Annotate | Download | only in usb

Lines Matching defs:task

175 SDT_PROBE_DEFINE3(usb, kernel, task, add,
176 "struct usbd_device *"/*dev*/, "struct usb_task *"/*task*/, "int"/*q*/);
177 SDT_PROBE_DEFINE2(usb, kernel, task, rem__start,
178 "struct usbd_device *"/*dev*/, "struct usb_task *"/*task*/);
179 SDT_PROBE_DEFINE3(usb, kernel, task, rem__done,
181 "struct usb_task *"/*task*/,
183 SDT_PROBE_DEFINE4(usb, kernel, task, rem__wait__start,
185 "struct usb_task *"/*task*/,
188 SDT_PROBE_DEFINE5(usb, kernel, task, rem__wait__done,
190 "struct usb_task *"/*task*/,
195 SDT_PROBE_DEFINE1(usb, kernel, task, start, "struct usb_task *"/*task*/);
196 SDT_PROBE_DEFINE1(usb, kernel, task, done, "struct usb_task *"/*task*/);
423 * Since USB task methods usb_{add,rem}_task are callable
433 printf("unable to create task thread: %s\n", taskq->name);
434 panic("usb_create_event_thread task");
560 * Add a task to be performed by the task thread. This function can be
561 * called from any context and the task will be executed in a process
565 usb_add_task(struct usbd_device *dev, struct usb_task *task, int queue)
570 SDT_PROBE3(usb, kernel, task, add, dev, task, queue);
576 if (atomic_cas_uint(&task->queue, USB_NUM_TASKQS, queue) ==
578 DPRINTFN(2, "task=%#jx", (uintptr_t)task, 0, 0, 0);
579 TAILQ_INSERT_TAIL(&taskq->tasks, task, next);
582 DPRINTFN(2, "task=%#jx on q", (uintptr_t)task, 0, 0, 0);
588 * usb_rem_task(dev, task)
590 * If task is queued to run, remove it from the queue. Return
591 * true if it successfully removed the task from the queue, false
594 * Caller is _not_ guaranteed that the task is not running when
600 usb_rem_task(struct usbd_device *dev, struct usb_task *task)
605 SDT_PROBE2(usb, kernel, task, rem__start, dev, task);
607 while ((queue = task->queue) != USB_NUM_TASKQS) {
610 if (__predict_true(task->queue == queue)) {
611 TAILQ_REMOVE(&taskq->tasks, task, next);
612 task->queue = USB_NUM_TASKQS;
614 SDT_PROBE3(usb, kernel, task, rem__done,
615 dev, task, true);
621 SDT_PROBE3(usb, kernel, task, rem__done, dev, task, false);
626 * usb_rem_task_wait(dev, task, queue, interlock)
628 * If task is scheduled to run, remove it from the queue. If it
631 * Return true if it successfully removed the task from the queue,
634 * Caller MUST guarantee that task will not be scheduled on a
637 * If caller guarantees that task will not be scheduled on the
639 * the task is not running at all when this returns.
644 usb_rem_task_wait(struct usbd_device *dev, struct usb_task *task, int queue,
652 SDT_PROBE4(usb, kernel, task, rem__wait__start,
653 dev, task, queue, interlock);
660 queue1 = task->queue;
669 while (taskq->current_task == task)
675 * task thread will run it.
677 KASSERTMSG(queue1 == queue, "task %p on q%d expected on q%d",
678 task, queue1, queue);
679 TAILQ_REMOVE(&taskq->tasks, task, next);
680 task->queue = USB_NUM_TASKQS;
692 SDT_PROBE5(usb, kernel, task, rem__wait__done,
693 dev, task, queue, interlock, removed);
698 * usb_task_pending(dev, task)
700 * True if task is queued, false if not. Note that if task is
705 * KASSERT(!usb_task_pending(dev, task));
708 usb_task_pending(struct usbd_device *dev, struct usb_task *task)
711 return task->queue != USB_NUM_TASKQS;
773 struct usb_task *task;
785 task = TAILQ_FIRST(&taskq->tasks);
786 if (task == NULL) {
788 task = TAILQ_FIRST(&taskq->tasks);
790 DPRINTFN(2, "woke up task=%#jx", (uintptr_t)task, 0, 0, 0);
791 if (task != NULL) {
792 mpsafe = ISSET(task->flags, USB_TASKQ_MPSAFE);
793 TAILQ_REMOVE(&taskq->tasks, task, next);
794 task->queue = USB_NUM_TASKQS;
795 taskq->current_task = task;
800 SDT_PROBE1(usb, kernel, task, start, task);
801 task->fun(task->arg);
802 /* Can't dereference task after this point. */
803 SDT_PROBE1(usb, kernel, task, done, task);
808 KASSERTMSG(taskq->current_task == task,