Lines Matching refs:ev_queue
137 spin_lock_irq(&ev_file->ev_queue.lock); in ib_uverbs_release_ucq()
142 spin_unlock_irq(&ev_file->ev_queue.lock); in ib_uverbs_release_ucq()
158 spin_lock_irq(&async_file->ev_queue.lock); in ib_uverbs_release_uevent()
163 spin_unlock_irq(&async_file->ev_queue.lock); in ib_uverbs_release_uevent()
214 static ssize_t ib_uverbs_event_read(struct ib_uverbs_event_queue *ev_queue, in ib_uverbs_event_read() argument
222 spin_lock_irq(&ev_queue->lock); in ib_uverbs_event_read()
224 while (list_empty(&ev_queue->event_list)) { in ib_uverbs_event_read()
225 if (ev_queue->is_closed) { in ib_uverbs_event_read()
226 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_read()
230 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_read()
234 if (wait_event_interruptible(ev_queue->poll_wait, in ib_uverbs_event_read()
235 (!list_empty(&ev_queue->event_list) || in ib_uverbs_event_read()
236 ev_queue->is_closed))) in ib_uverbs_event_read()
239 spin_lock_irq(&ev_queue->lock); in ib_uverbs_event_read()
242 event = list_entry(ev_queue->event_list.next, struct ib_uverbs_event, list); in ib_uverbs_event_read()
248 list_del(ev_queue->event_list.next); in ib_uverbs_event_read()
255 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_read()
274 return ib_uverbs_event_read(&file->ev_queue, filp, buf, count, pos, in ib_uverbs_async_event_read()
284 return ib_uverbs_event_read(&comp_ev_file->ev_queue, filp, buf, count, in ib_uverbs_comp_event_read()
289 static __poll_t ib_uverbs_event_poll(struct ib_uverbs_event_queue *ev_queue, in ib_uverbs_event_poll() argument
295 poll_wait(filp, &ev_queue->poll_wait, wait); in ib_uverbs_event_poll()
297 spin_lock_irq(&ev_queue->lock); in ib_uverbs_event_poll()
298 if (!list_empty(&ev_queue->event_list)) in ib_uverbs_event_poll()
300 else if (ev_queue->is_closed) in ib_uverbs_event_poll()
302 spin_unlock_irq(&ev_queue->lock); in ib_uverbs_event_poll()
312 return ib_uverbs_event_poll(&file->ev_queue, filp, wait); in ib_uverbs_async_event_poll()
321 return ib_uverbs_event_poll(&comp_ev_file->ev_queue, filp, wait); in ib_uverbs_comp_event_poll()
328 return fasync_helper(fd, filp, on, &file->ev_queue.async_queue); in ib_uverbs_async_event_fasync()
336 return fasync_helper(fd, filp, on, &comp_ev_file->ev_queue.async_queue); in ib_uverbs_comp_event_fasync()
359 struct ib_uverbs_event_queue *ev_queue = cq_context; in ib_uverbs_comp_handler() local
364 if (!ev_queue) in ib_uverbs_comp_handler()
367 spin_lock_irqsave(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
368 if (ev_queue->is_closed) { in ib_uverbs_comp_handler()
369 spin_unlock_irqrestore(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
375 spin_unlock_irqrestore(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
384 list_add_tail(&entry->list, &ev_queue->event_list); in ib_uverbs_comp_handler()
386 spin_unlock_irqrestore(&ev_queue->lock, flags); in ib_uverbs_comp_handler()
388 wake_up_interruptible(&ev_queue->poll_wait); in ib_uverbs_comp_handler()
389 kill_fasync(&ev_queue->async_queue, SIGIO, POLL_IN); in ib_uverbs_comp_handler()
402 spin_lock_irqsave(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
403 if (async_file->ev_queue.is_closed) { in ib_uverbs_async_handler()
404 spin_unlock_irqrestore(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
410 spin_unlock_irqrestore(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
419 list_add_tail(&entry->list, &async_file->ev_queue.event_list); in ib_uverbs_async_handler()
422 spin_unlock_irqrestore(&async_file->ev_queue.lock, flags); in ib_uverbs_async_handler()
424 wake_up_interruptible(&async_file->ev_queue.poll_wait); in ib_uverbs_async_handler()
425 kill_fasync(&async_file->ev_queue.async_queue, SIGIO, POLL_IN); in ib_uverbs_async_handler()
469 void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue) in ib_uverbs_init_event_queue() argument
471 spin_lock_init(&ev_queue->lock); in ib_uverbs_init_event_queue()
472 INIT_LIST_HEAD(&ev_queue->event_list); in ib_uverbs_init_event_queue()
473 init_waitqueue_head(&ev_queue->poll_wait); in ib_uverbs_init_event_queue()
474 ev_queue->is_closed = 0; in ib_uverbs_init_event_queue()
475 ev_queue->async_queue = NULL; in ib_uverbs_init_event_queue()
484 ib_uverbs_init_event_queue(&async_file->ev_queue); in ib_uverbs_init_async_event_file()