drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c- Extension
.c- Size
- 13486 bytes
- Lines
- 520
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hbrcmu_wifi.hbrcmu_utils.hcfg80211.hcore.hdebug.htracepoint.hfweh.hfwil.hproto.hbus.hfwvid.h
Detected Declarations
struct brcmf_fweh_queue_itemstruct brcmf_fweh_event_namefunction brcmf_fweh_event_namefunction brcmf_fweh_queue_eventfunction brcmf_fweh_call_event_handlerfunction brcmf_fweh_handle_if_eventfunction brcmf_fweh_map_event_codefunction brcmf_fweh_map_fwevt_codefunction brcmf_fweh_dequeue_eventfunction brcmf_fweh_event_workerfunction brcmf_fweh_p2pdev_setupfunction brcmf_fweh_attachfunction brcmf_fweh_detachfunction brcmf_fweh_registerfunction brcmf_fweh_unregisterfunction brcmf_fweh_activate_eventsfunction brcmf_fweh_process_event
Annotated Snippet
struct brcmf_fweh_queue_item {
struct list_head q;
u32 code;
u8 ifidx;
u8 ifaddr[ETH_ALEN];
struct brcmf_event_msg_be emsg;
u32 datalen;
u8 data[] __counted_by(datalen);
};
/*
* struct brcmf_fweh_event_name - code, name mapping entry.
*/
struct brcmf_fweh_event_name {
enum brcmf_fweh_event_code code;
const char *name;
};
#ifdef DEBUG
#define BRCMF_ENUM_DEF(id, val) \
{ val, #id },
/* array for mapping code to event name */
static struct brcmf_fweh_event_name fweh_event_names[] = {
BRCMF_FWEH_EVENT_ENUM_DEFLIST
};
#undef BRCMF_ENUM_DEF
/**
* brcmf_fweh_event_name() - returns name for given event code.
*
* @code: code to lookup.
*/
const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code)
{
int i;
for (i = 0; i < ARRAY_SIZE(fweh_event_names); i++) {
if (fweh_event_names[i].code == code)
return fweh_event_names[i].name;
}
return "unknown";
}
#else
const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code)
{
return "nodebug";
}
#endif
BRCMF_EXPORT_SYMBOL_GPL(brcmf_fweh_event_name);
/**
* brcmf_fweh_queue_event() - create and queue event.
*
* @fweh: firmware event handling info.
* @event: event queue entry.
*/
static void brcmf_fweh_queue_event(struct brcmf_fweh_info *fweh,
struct brcmf_fweh_queue_item *event)
{
ulong flags;
spin_lock_irqsave(&fweh->evt_q_lock, flags);
list_add_tail(&event->q, &fweh->event_q);
spin_unlock_irqrestore(&fweh->evt_q_lock, flags);
schedule_work(&fweh->event_work);
}
static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr,
struct brcmf_if *ifp,
u32 fwcode,
struct brcmf_event_msg *emsg,
void *data)
{
struct brcmf_fweh_info *fweh;
int err = -EINVAL;
if (ifp) {
fweh = ifp->drvr->fweh;
/* handle the event if valid interface and handler */
if (fweh->evt_handler[fwcode])
err = fweh->evt_handler[fwcode](ifp, emsg, data);
else
bphy_err(drvr, "unhandled fwevt %d ignored\n", fwcode);
} else {
bphy_err(drvr, "no interface object\n");
}
return err;
}
Annotation
- Immediate include surface: `linux/netdevice.h`, `brcmu_wifi.h`, `brcmu_utils.h`, `cfg80211.h`, `core.h`, `debug.h`, `tracepoint.h`, `fweh.h`.
- Detected declarations: `struct brcmf_fweh_queue_item`, `struct brcmf_fweh_event_name`, `function brcmf_fweh_event_name`, `function brcmf_fweh_queue_event`, `function brcmf_fweh_call_event_handler`, `function brcmf_fweh_handle_if_event`, `function brcmf_fweh_map_event_code`, `function brcmf_fweh_map_fwevt_code`, `function brcmf_fweh_dequeue_event`, `function brcmf_fweh_event_worker`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.