Lines Matching refs:fweh
85 static void brcmf_fweh_queue_event(struct brcmf_fweh_info *fweh, in brcmf_fweh_queue_event() argument
90 spin_lock_irqsave(&fweh->evt_q_lock, flags); in brcmf_fweh_queue_event()
91 list_add_tail(&event->q, &fweh->event_q); in brcmf_fweh_queue_event()
92 spin_unlock_irqrestore(&fweh->evt_q_lock, flags); in brcmf_fweh_queue_event()
93 schedule_work(&fweh->event_work); in brcmf_fweh_queue_event()
102 struct brcmf_fweh_info *fweh; in brcmf_fweh_call_event_handler() local
106 fweh = ifp->drvr->fweh; in brcmf_fweh_call_event_handler()
109 if (fweh->evt_handler[fwcode]) in brcmf_fweh_call_event_handler()
110 err = fweh->evt_handler[fwcode](ifp, emsg, data); in brcmf_fweh_call_event_handler()
146 (drvr->fweh->p2pdev_setup_ongoing)))); in brcmf_fweh_handle_if_event()
167 if (!drvr->fweh->evt_handler[BRCMF_E_IF]) in brcmf_fweh_handle_if_event()
187 static void brcmf_fweh_map_event_code(struct brcmf_fweh_info *fweh, in brcmf_fweh_map_event_code() argument
197 if (fweh->event_map) { in brcmf_fweh_map_event_code()
198 for (i = 0; i < fweh->event_map->n_items; i++) { in brcmf_fweh_map_event_code()
199 if (fweh->event_map->items[i].code == code) { in brcmf_fweh_map_event_code()
200 *fw_code = fweh->event_map->items[i].fwevt_code; in brcmf_fweh_map_event_code()
207 static void brcmf_fweh_map_fwevt_code(struct brcmf_fweh_info *fweh, u32 fw_code, in brcmf_fweh_map_fwevt_code() argument
216 if (fweh->event_map) { in brcmf_fweh_map_fwevt_code()
217 for (i = 0; i < fweh->event_map->n_items; i++) { in brcmf_fweh_map_fwevt_code()
218 if (fweh->event_map->items[i].fwevt_code == fw_code) { in brcmf_fweh_map_fwevt_code()
219 *code = fweh->event_map->items[i].code; in brcmf_fweh_map_fwevt_code()
232 brcmf_fweh_dequeue_event(struct brcmf_fweh_info *fweh) in brcmf_fweh_dequeue_event() argument
237 spin_lock_irqsave(&fweh->evt_q_lock, flags); in brcmf_fweh_dequeue_event()
238 if (!list_empty(&fweh->event_q)) { in brcmf_fweh_dequeue_event()
239 event = list_first_entry(&fweh->event_q, in brcmf_fweh_dequeue_event()
243 spin_unlock_irqrestore(&fweh->evt_q_lock, flags); in brcmf_fweh_dequeue_event()
257 struct brcmf_fweh_info *fweh; in brcmf_fweh_event_worker() local
263 fweh = container_of(work, struct brcmf_fweh_info, event_work); in brcmf_fweh_event_worker()
264 drvr = fweh->drvr; in brcmf_fweh_event_worker()
266 while ((event = brcmf_fweh_dequeue_event(fweh))) { in brcmf_fweh_event_worker()
269 brcmf_fweh_map_fwevt_code(fweh, event->code, &code); in brcmf_fweh_event_worker()
330 ifp->drvr->fweh->p2pdev_setup_ongoing = ongoing; in brcmf_fweh_p2pdev_setup()
340 struct brcmf_fweh_info *fweh; in brcmf_fweh_attach() local
347 fweh = drvr->fweh; in brcmf_fweh_attach()
348 fweh->drvr = drvr; in brcmf_fweh_attach()
350 fweh->event_mask_len = DIV_ROUND_UP(fweh->num_event_codes, 8); in brcmf_fweh_attach()
351 fweh->event_mask = kzalloc(fweh->event_mask_len, GFP_KERNEL); in brcmf_fweh_attach()
352 if (!fweh->event_mask) in brcmf_fweh_attach()
355 INIT_WORK(&fweh->event_work, brcmf_fweh_event_worker); in brcmf_fweh_attach()
356 spin_lock_init(&fweh->evt_q_lock); in brcmf_fweh_attach()
357 INIT_LIST_HEAD(&fweh->event_q); in brcmf_fweh_attach()
368 struct brcmf_fweh_info *fweh = drvr->fweh; in brcmf_fweh_detach() local
370 if (!fweh) in brcmf_fweh_detach()
374 if (fweh->event_work.func) { in brcmf_fweh_detach()
375 cancel_work_sync(&fweh->event_work); in brcmf_fweh_detach()
376 WARN_ON(!list_empty(&fweh->event_q)); in brcmf_fweh_detach()
378 drvr->fweh = NULL; in brcmf_fweh_detach()
379 kfree(fweh->event_mask); in brcmf_fweh_detach()
380 kfree(fweh); in brcmf_fweh_detach()
393 struct brcmf_fweh_info *fweh = drvr->fweh; in brcmf_fweh_register() local
396 brcmf_fweh_map_event_code(fweh, code, &evt_handler_idx); in brcmf_fweh_register()
398 if (fweh->evt_handler[evt_handler_idx]) { in brcmf_fweh_register()
403 fweh->evt_handler[evt_handler_idx] = handler; in brcmf_fweh_register()
422 brcmf_fweh_map_event_code(drvr->fweh, code, &evt_handler_idx); in brcmf_fweh_unregister()
423 drvr->fweh->evt_handler[evt_handler_idx] = NULL; in brcmf_fweh_unregister()
433 struct brcmf_fweh_info *fweh = ifp->drvr->fweh; in brcmf_fweh_activate_events() local
437 memset(fweh->event_mask, 0, fweh->event_mask_len); in brcmf_fweh_activate_events()
438 for (i = 0; i < fweh->num_event_codes; i++) { in brcmf_fweh_activate_events()
439 if (fweh->evt_handler[i]) { in brcmf_fweh_activate_events()
440 brcmf_fweh_map_fwevt_code(fweh, i, &code); in brcmf_fweh_activate_events()
443 setbit(fweh->event_mask, i); in brcmf_fweh_activate_events()
449 setbit(fweh->event_mask, BRCMF_E_IF); in brcmf_fweh_activate_events()
451 err = brcmf_fil_iovar_data_set(ifp, "event_msgs", fweh->event_mask, in brcmf_fweh_activate_events()
452 fweh->event_mask_len); in brcmf_fweh_activate_events()
454 bphy_err(fweh->drvr, "Set event_msgs error (%d)\n", err); in brcmf_fweh_activate_events()
475 struct brcmf_fweh_info *fweh = drvr->fweh; in brcmf_fweh_process_event() local
485 if (fwevt_idx >= fweh->num_event_codes) in brcmf_fweh_process_event()
488 if (fwevt_idx != BRCMF_E_IF && !fweh->evt_handler[fwevt_idx]) in brcmf_fweh_process_event()
508 brcmf_fweh_queue_event(fweh, event); in brcmf_fweh_process_event()