Lines Matching defs:queue

20 /* output queue handling */
43 struct wiimote_queue *queue = container_of(work, struct wiimote_queue,
45 struct wiimote_data *wdata = container_of(queue, struct wiimote_data,
46 queue);
50 spin_lock_irqsave(&wdata->queue.lock, flags);
52 while (wdata->queue.head != wdata->queue.tail) {
53 spin_unlock_irqrestore(&wdata->queue.lock, flags);
55 wdata->queue.outq[wdata->queue.tail].data,
56 wdata->queue.outq[wdata->queue.tail].size);
62 spin_lock_irqsave(&wdata->queue.lock, flags);
64 wdata->queue.tail = (wdata->queue.tail + 1) % WIIMOTE_BUFSIZE;
67 spin_unlock_irqrestore(&wdata->queue.lock, flags);
79 spin_lock_irqsave(&wdata->queue.lock, flags);
84 * Copy new request into our output queue and check whether the
85 * queue is full. If it is full, discard this request.
88 * If the queue is not empty, then there must be a worker
90 * will reschedule itself until the queue is empty.
93 spin_lock_irqsave(&wdata->queue.lock, flags);
95 memcpy(wdata->queue.outq[wdata->queue.head].data, buffer, count);
96 wdata->queue.outq[wdata->queue.head].size = count;
97 newhead = (wdata->queue.head + 1) % WIIMOTE_BUFSIZE;
99 if (wdata->queue.head == wdata->queue.tail) {
100 wdata->queue.head = newhead;
101 schedule_work(&wdata->queue.worker);
102 } else if (newhead != wdata->queue.tail) {
103 wdata->queue.head = newhead;
105 hid_warn(wdata->hdev, "Output queue is full");
114 spin_unlock_irqrestore(&wdata->queue.lock, flags);
122 * into the output queue!
1740 spin_lock_init(&wdata->queue.lock);
1741 INIT_WORK(&wdata->queue.worker, wiimote_queue_worker);
1775 cancel_work_sync(&wdata->queue.worker);