Lines Matching refs:waiter
37 static bool add_waiter_to_queue(struct host1x_waitlist *waiter, in add_waiter_to_queue() argument
41 u32 thresh = waiter->thresh; in add_waiter_to_queue()
45 list_add(&waiter->list, &pos->list); in add_waiter_to_queue()
49 list_add(&waiter->list, queue); in add_waiter_to_queue()
61 struct host1x_waitlist *waiter, *next, *prev; in remove_completed_waiters() local
63 list_for_each_entry_safe(waiter, next, head, list) { in remove_completed_waiters()
64 if ((s32)(waiter->thresh - sync) > 0) in remove_completed_waiters()
67 dest = completed + waiter->action; in remove_completed_waiters()
70 if (waiter->action == HOST1X_INTR_ACTION_SUBMIT_COMPLETE && in remove_completed_waiters()
74 if (prev->data == waiter->data) { in remove_completed_waiters()
81 if (atomic_inc_return(&waiter->state) == WLS_HANDLED || !dest) { in remove_completed_waiters()
82 list_del(&waiter->list); in remove_completed_waiters()
83 kref_put(&waiter->refcount, waiter_release); in remove_completed_waiters()
85 list_move_tail(&waiter->list, dest); in remove_completed_waiters()
100 static void action_submit_complete(struct host1x_waitlist *waiter) in action_submit_complete() argument
102 struct host1x_channel *channel = waiter->data; in action_submit_complete()
108 waiter->count, waiter->thresh); in action_submit_complete()
111 static void action_wakeup(struct host1x_waitlist *waiter) in action_wakeup() argument
113 wait_queue_head_t *wq = waiter->data; in action_wakeup()
118 static void action_wakeup_interruptible(struct host1x_waitlist *waiter) in action_wakeup_interruptible() argument
120 wait_queue_head_t *wq = waiter->data; in action_wakeup_interruptible()
125 static void action_signal_fence(struct host1x_waitlist *waiter) in action_signal_fence() argument
127 struct host1x_syncpt_fence *f = waiter->data; in action_signal_fence()
132 typedef void (*action_handler)(struct host1x_waitlist *waiter);
148 struct host1x_waitlist *waiter, *next; in run_handlers() local
150 list_for_each_entry_safe(waiter, next, head, list) { in run_handlers()
151 list_del(&waiter->list); in run_handlers()
152 handler(waiter); in run_handlers()
153 WARN_ON(atomic_xchg(&waiter->state, WLS_HANDLED) != in run_handlers()
155 kref_put(&waiter->refcount, waiter_release); in run_handlers()
213 void *data, struct host1x_waitlist *waiter, in host1x_intr_add_action() argument
218 if (waiter == NULL) { in host1x_intr_add_action()
224 INIT_LIST_HEAD(&waiter->list); in host1x_intr_add_action()
225 kref_init(&waiter->refcount); in host1x_intr_add_action()
227 kref_get(&waiter->refcount); in host1x_intr_add_action()
228 waiter->thresh = thresh; in host1x_intr_add_action()
229 waiter->action = action; in host1x_intr_add_action()
230 atomic_set(&waiter->state, WLS_PENDING); in host1x_intr_add_action()
231 waiter->data = data; in host1x_intr_add_action()
232 waiter->count = 1; in host1x_intr_add_action()
238 if (add_waiter_to_queue(waiter, &syncpt->intr.wait_head)) { in host1x_intr_add_action()
248 *ref = waiter; in host1x_intr_add_action()
258 struct host1x_waitlist *waiter = ref; in host1x_intr_put_ref() local
261 atomic_cmpxchg(&waiter->state, WLS_PENDING, WLS_CANCELLED); in host1x_intr_put_ref()
266 if (atomic_cmpxchg(&waiter->state, WLS_CANCELLED, WLS_HANDLED) == in host1x_intr_put_ref()
268 list_del(&waiter->list); in host1x_intr_put_ref()
269 kref_put(&waiter->refcount, waiter_release); in host1x_intr_put_ref()
275 while (atomic_read(&waiter->state) != WLS_HANDLED) in host1x_intr_put_ref()
279 kref_put(&waiter->refcount, waiter_release); in host1x_intr_put_ref()
336 struct host1x_waitlist *waiter, *next; in host1x_intr_stop() local
338 list_for_each_entry_safe(waiter, next, in host1x_intr_stop()
340 if (atomic_cmpxchg(&waiter->state, in host1x_intr_stop()
342 list_del(&waiter->list); in host1x_intr_stop()
343 kref_put(&waiter->refcount, waiter_release); in host1x_intr_stop()