• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/uwb/

Lines Matching defs:neh

43  * 4, Release the reference to the neh [uwb_rc_neh_put()]
75 * the handle [w/ neh->extra_size()].
120 struct uwb_rc_neh *neh = container_of(kref, struct uwb_rc_neh, kref);
122 kfree(neh);
125 static void uwb_rc_neh_get(struct uwb_rc_neh *neh)
127 kref_get(&neh->kref);
131 * uwb_rc_neh_put - release reference to a neh
132 * @neh: the neh
134 void uwb_rc_neh_put(struct uwb_rc_neh *neh)
136 kref_put(&neh->kref, uwb_rc_neh_release);
141 * Assigns @neh a context id from @rc's pool
144 * @neh: Notification/Event Handle
155 * consecutive opened @neh's getting the same context ID assigned (to
161 int __uwb_rc_ctx_get(struct uwb_rc *rc, struct uwb_rc_neh *neh)
174 neh->context = result;
179 /** Releases @neh's context ID back to @rc (@rc->neh_lock is locked). */
181 void __uwb_rc_ctx_put(struct uwb_rc *rc, struct uwb_rc_neh *neh)
184 if (neh->context == 0)
186 if (test_bit(neh->context, rc->ctx_bm) == 0) {
188 neh->context);
191 clear_bit(neh->context, rc->ctx_bm);
192 neh->context = 0;
196 * uwb_rc_neh_add - add a neh for a radio controller command
204 * Creates a neh and adds it to the list of those waiting for an
214 struct uwb_rc_neh *neh;
216 neh = kzalloc(sizeof(*neh), GFP_KERNEL);
217 if (neh == NULL) {
222 kref_init(&neh->kref);
223 INIT_LIST_HEAD(&neh->list_node);
224 init_timer(&neh->timer);
225 neh->timer.function = uwb_rc_neh_timer;
226 neh->timer.data = (unsigned long)neh;
228 neh->rc = rc;
229 neh->evt_type = expected_type;
230 neh->evt = cpu_to_le16(expected_event);
231 neh->cb = cb;
232 neh->arg = arg;
235 result = __uwb_rc_ctx_get(rc, neh);
237 cmd->bCommandContext = neh->context;
238 list_add_tail(&neh->list_node, &rc->neh_list);
239 uwb_rc_neh_get(neh);
245 return neh;
248 kfree(neh);
254 static void __uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
256 __uwb_rc_ctx_put(rc, neh);
257 list_del(&neh->list_node);
261 * uwb_rc_neh_rm - remove a neh.
263 * @neh: the neh to remove
265 * Remove an active neh immediately instead of waiting for the event
268 void uwb_rc_neh_rm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
273 __uwb_rc_neh_rm(rc, neh);
276 del_timer_sync(&neh->timer);
277 uwb_rc_neh_put(neh);
284 * @neh: Notification/event handler for @rc
286 * The timer is only armed if the neh is active.
288 void uwb_rc_neh_arm(struct uwb_rc *rc, struct uwb_rc_neh *neh)
293 if (neh->context)
294 mod_timer(&neh->timer,
299 static void uwb_rc_neh_cb(struct uwb_rc_neh *neh, struct uwb_rceb *rceb, size_t size)
301 (*neh->cb)(neh->rc, neh->arg, rceb, size);
302 uwb_rc_neh_put(neh);
305 static bool uwb_rc_neh_match(struct uwb_rc_neh *neh, const struct uwb_rceb *rceb)
307 return neh->evt_type == rceb->bEventType
308 && neh->evt == rceb->wEvent
309 && neh->context == rceb->bEventContext;
318 * adjusted to take into account the @neh->extra_size
322 * the right size (the amount of data received). @neh->ptr will point
330 struct uwb_rc_neh *neh = NULL, *h;
337 neh = h;
342 if (neh)
343 __uwb_rc_neh_rm(rc, neh);
347 return neh;
355 * @neh: Notification/Event Handler @neh->ptr points to
364 * handling code in neh.c [uwb_rc_neh_lookup()]. What is actually
409 struct uwb_rc_neh *neh;
422 neh = uwb_rc_neh_lookup(rc, rceb);
423 if (neh) {
424 del_timer_sync(&neh->timer);
425 uwb_rc_neh_cb(neh, rceb, size);
450 * tables, then looks for a neh that is waiting for that event and if
451 * found, copies the payload to the neh's buffer and calls it back. If
455 * still might find a size in the 'neh' handle in uwb_rc_neh_lookup().
543 struct uwb_rc_neh *neh;
552 neh = list_first_entry(&rc->neh_list, struct uwb_rc_neh, list_node);
553 __uwb_rc_neh_rm(rc, neh);
556 del_timer_sync(&neh->timer);
557 uwb_rc_neh_cb(neh, NULL, error);
565 struct uwb_rc_neh *neh = (struct uwb_rc_neh *)arg;
566 struct uwb_rc *rc = neh->rc;
570 if (neh->context)
571 __uwb_rc_neh_rm(rc, neh);
573 neh = NULL;
576 if (neh)
577 uwb_rc_neh_cb(neh, NULL, -ETIMEDOUT);
580 /** Initializes the @rc's neh subsystem
592 /** Release's the @rc's neh subsystem */
596 struct uwb_rc_neh *neh;
604 neh = list_first_entry(&rc->neh_list, struct uwb_rc_neh, list_node);
605 __uwb_rc_neh_rm(rc, neh);
608 del_timer_sync(&neh->timer);
609 uwb_rc_neh_put(neh);