Lines Matching refs:neh

122 	struct uwb_rc_neh *neh = container_of(kref, struct uwb_rc_neh, kref);  in uwb_rc_neh_release()  local
124 kfree(neh); in uwb_rc_neh_release()
127 static void uwb_rc_neh_get(struct uwb_rc_neh *neh) in uwb_rc_neh_get() argument
129 kref_get(&neh->kref); in uwb_rc_neh_get()
136 void uwb_rc_neh_put(struct uwb_rc_neh *neh) in uwb_rc_neh_put() argument
138 kref_put(&neh->kref, uwb_rc_neh_release); in uwb_rc_neh_put()
163 int __uwb_rc_ctx_get(struct uwb_rc *rc, struct uwb_rc_neh *neh) in __uwb_rc_ctx_get() argument
176 neh->context = result; in __uwb_rc_ctx_get()
183 void __uwb_rc_ctx_put(struct uwb_rc *rc, struct uwb_rc_neh *neh) in __uwb_rc_ctx_put() argument
186 if (neh->context == 0) in __uwb_rc_ctx_put()
188 if (test_bit(neh->context, rc->ctx_bm) == 0) { in __uwb_rc_ctx_put()
190 neh->context); in __uwb_rc_ctx_put()
193 clear_bit(neh->context, rc->ctx_bm); in __uwb_rc_ctx_put()
194 neh->context = 0; in __uwb_rc_ctx_put()
216 struct uwb_rc_neh *neh; in uwb_rc_neh_add() local
218 neh = kzalloc(sizeof(*neh), GFP_KERNEL); in uwb_rc_neh_add()
219 if (neh == NULL) { in uwb_rc_neh_add()
224 kref_init(&neh->kref); in uwb_rc_neh_add()
225 INIT_LIST_HEAD(&neh->list_node); in uwb_rc_neh_add()
226 setup_timer(&neh->timer, uwb_rc_neh_timer, (unsigned long)neh); in uwb_rc_neh_add()
228 neh->rc = rc; in uwb_rc_neh_add()
229 neh->evt_type = expected_type; in uwb_rc_neh_add()
230 neh->evt = cpu_to_le16(expected_event); in uwb_rc_neh_add()
231 neh->cb = cb; in uwb_rc_neh_add()
232 neh->arg = arg; in uwb_rc_neh_add()
235 result = __uwb_rc_ctx_get(rc, neh); in uwb_rc_neh_add()
237 cmd->bCommandContext = neh->context; in uwb_rc_neh_add()
238 list_add_tail(&neh->list_node, &rc->neh_list); in uwb_rc_neh_add()
239 uwb_rc_neh_get(neh); in uwb_rc_neh_add()
245 return neh; in uwb_rc_neh_add()
248 kfree(neh); in uwb_rc_neh_add()
254 static void __uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh) in __uwb_rc_neh_rm() argument
256 __uwb_rc_ctx_put(rc, neh); in __uwb_rc_neh_rm()
257 list_del(&neh->list_node); in __uwb_rc_neh_rm()
268 void uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh) in uwb_rc_neh_rm() argument
273 __uwb_rc_neh_rm(rc, neh); in uwb_rc_neh_rm()
276 del_timer_sync(&neh->timer); in uwb_rc_neh_rm()
277 uwb_rc_neh_put(neh); in uwb_rc_neh_rm()
288 void uwb_rc_neh_arm(struct uwb_rc *rc, struct uwb_rc_neh *neh) in uwb_rc_neh_arm() argument
293 if (neh->context) in uwb_rc_neh_arm()
294 mod_timer(&neh->timer, in uwb_rc_neh_arm()
299 static void uwb_rc_neh_cb(struct uwb_rc_neh *neh, struct uwb_rceb *rceb, size_t size) in uwb_rc_neh_cb() argument
301 (*neh->cb)(neh->rc, neh->arg, rceb, size); in uwb_rc_neh_cb()
302 uwb_rc_neh_put(neh); in uwb_rc_neh_cb()
305 static bool uwb_rc_neh_match(struct uwb_rc_neh *neh, const struct uwb_rceb *rceb) in uwb_rc_neh_match() argument
307 return neh->evt_type == rceb->bEventType in uwb_rc_neh_match()
308 && neh->evt == rceb->wEvent in uwb_rc_neh_match()
309 && neh->context == rceb->bEventContext; in uwb_rc_neh_match()
330 struct uwb_rc_neh *neh = NULL, *h; in uwb_rc_neh_lookup() local
337 neh = h; in uwb_rc_neh_lookup()
342 if (neh) in uwb_rc_neh_lookup()
343 __uwb_rc_neh_rm(rc, neh); in uwb_rc_neh_lookup()
347 return neh; in uwb_rc_neh_lookup()
409 struct uwb_rc_neh *neh; in uwb_rc_neh_grok_event() local
423 neh = uwb_rc_neh_lookup(rc, rceb); in uwb_rc_neh_grok_event()
424 if (neh) { in uwb_rc_neh_grok_event()
427 neh->completed = 1; in uwb_rc_neh_grok_event()
428 del_timer(&neh->timer); in uwb_rc_neh_grok_event()
430 uwb_rc_neh_cb(neh, rceb, size); in uwb_rc_neh_grok_event()
548 struct uwb_rc_neh *neh; in uwb_rc_neh_error() local
557 neh = list_first_entry(&rc->neh_list, struct uwb_rc_neh, list_node); in uwb_rc_neh_error()
558 __uwb_rc_neh_rm(rc, neh); in uwb_rc_neh_error()
561 del_timer_sync(&neh->timer); in uwb_rc_neh_error()
562 uwb_rc_neh_cb(neh, NULL, error); in uwb_rc_neh_error()
570 struct uwb_rc_neh *neh = (struct uwb_rc_neh *)arg; in uwb_rc_neh_timer() local
571 struct uwb_rc *rc = neh->rc; in uwb_rc_neh_timer()
575 if (neh->completed) { in uwb_rc_neh_timer()
579 if (neh->context) in uwb_rc_neh_timer()
580 __uwb_rc_neh_rm(rc, neh); in uwb_rc_neh_timer()
582 neh = NULL; in uwb_rc_neh_timer()
585 if (neh) in uwb_rc_neh_timer()
586 uwb_rc_neh_cb(neh, NULL, -ETIMEDOUT); in uwb_rc_neh_timer()
605 struct uwb_rc_neh *neh; in uwb_rc_neh_destroy() local
613 neh = list_first_entry(&rc->neh_list, struct uwb_rc_neh, list_node); in uwb_rc_neh_destroy()
614 __uwb_rc_neh_rm(rc, neh); in uwb_rc_neh_destroy()
617 del_timer_sync(&neh->timer); in uwb_rc_neh_destroy()
618 uwb_rc_neh_put(neh); in uwb_rc_neh_destroy()