Lines Matching refs:ev_queue

150 		spin_lock_irq(&ev_file->ev_queue.lock);  in ib_uverbs_release_ucq()
155 spin_unlock_irq(&ev_file->ev_queue.lock); in ib_uverbs_release_ucq()
171 spin_lock_irq(&async_file->ev_queue.lock); in ib_uverbs_release_uevent()
176 spin_unlock_irq(&async_file->ev_queue.lock); in ib_uverbs_release_uevent()
228 static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_queue *ev_queue, in ib_uverbs_event_read() argument
236 spin_lock_irq(&ev_queue->lock); in ib_uverbs_event_read()
238 while (list_empty(&ev_queue->event_list)) { in ib_uverbs_event_read()
239 if (ev_queue->is_closed) { in ib_uverbs_event_read()
240 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_read()
244 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_read()
248 if (wait_event_interruptible(ev_queue->poll_wait, in ib_uverbs_event_read()
249 (!list_empty(&ev_queue->event_list) || in ib_uverbs_event_read()
250 ev_queue->is_closed))) in ib_uverbs_event_read()
253 spin_lock_irq(&ev_queue->lock); in ib_uverbs_event_read()
256 event = list_entry(ev_queue->event_list.next, struct ib_uverbs_event, list); in ib_uverbs_event_read()
262 list_del(ev_queue->event_list.next); in ib_uverbs_event_read()
269 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_read()
288 return ib_uverbs_event_read(&file->ev_queue, filp, buf, count, pos, in ib_uverbs_async_event_read()
298 return ib_uverbs_event_read(&comp_ev_file->ev_queue, filp, buf, count, in ib_uverbs_comp_event_read()
303 static __poll_t ib_uverbs_event_poll(struct ib_uverbs_event_queue *ev_queue, in ib_uverbs_event_poll() argument
309 poll_wait(filp, &ev_queue->poll_wait, wait); in ib_uverbs_event_poll()
311 spin_lock_irq(&ev_queue->lock); in ib_uverbs_event_poll()
312 if (!list_empty(&ev_queue->event_list)) in ib_uverbs_event_poll()
314 else if (ev_queue->is_closed) in ib_uverbs_event_poll()
316 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_poll()
326 return ib_uverbs_event_poll(&file->ev_queue, filp, wait); in ib_uverbs_async_event_poll()
335 return ib_uverbs_event_poll(&comp_ev_file->ev_queue, filp, wait); in ib_uverbs_comp_event_poll()
342 return fasync_helper(fd, filp, on, &file->ev_queue.async_queue); in ib_uverbs_async_event_fasync()
350 return fasync_helper(fd, filp, on, &comp_ev_file->ev_queue.async_queue); in ib_uverbs_comp_event_fasync()
371 struct ib_uverbs_event_queue *ev_queue = cq_context; in ib_uverbs_comp_handler() local
376 if (!ev_queue) in ib_uverbs_comp_handler()
379 spin_lock_irqsave(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
380 if (ev_queue->is_closed) { in ib_uverbs_comp_handler()
381 spin_unlock_irqrestore(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
387 spin_unlock_irqrestore(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
396 list_add_tail(&entry->list, &ev_queue->event_list); in ib_uverbs_comp_handler()
398 spin_unlock_irqrestore(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
400 wake_up_interruptible(&ev_queue->poll_wait); in ib_uverbs_comp_handler()
401 kill_fasync(&ev_queue->async_queue, SIGIO, POLL_IN); in ib_uverbs_comp_handler()
414 spin_lock_irqsave(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
415 if (async_file->ev_queue.is_closed) { in ib_uverbs_async_handler()
416 spin_unlock_irqrestore(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
422 spin_unlock_irqrestore(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
431 list_add_tail(&entry->list, &async_file->ev_queue.event_list); in ib_uverbs_async_handler()
434 spin_unlock_irqrestore(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
436 wake_up_interruptible(&async_file->ev_queue.poll_wait); in ib_uverbs_async_handler()
437 kill_fasync(&async_file->ev_queue.async_queue, SIGIO, POLL_IN); in ib_uverbs_async_handler()
481 void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue) in ib_uverbs_init_event_queue() argument
483 spin_lock_init(&ev_queue->lock); in ib_uverbs_init_event_queue()
484 INIT_LIST_HEAD(&ev_queue->event_list); in ib_uverbs_init_event_queue()
485 init_waitqueue_head(&ev_queue->poll_wait); in ib_uverbs_init_event_queue()
486 ev_queue->is_closed = 0; in ib_uverbs_init_event_queue()
487 ev_queue->async_queue = NULL; in ib_uverbs_init_event_queue()
496 ib_uverbs_init_event_queue(&async_file->ev_queue); in ib_uverbs_init_async_event_file()