drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwvid.c- Extension
.c- Size
- 4541 bytes
- Lines
- 201
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/export.hlinux/module.hlinux/kmod.hlinux/list.hlinux/completion.hlinux/mutex.hlinux/printk.hlinux/jiffies.hlinux/workqueue.hcore.hbus.hdebug.hfwvid.hwcc/vops.hcyw/vops.hbca/vops.h
Detected Declarations
struct brcmf_fwvid_entryfunction brcmf_fwvid_request_modulefunction brcmf_fwvid_register_vendorfunction brcmf_fwvid_unregister_vendorfunction list_for_each_entry_safefunction brcmf_fwvid_request_modulefunction brcmf_fwvid_attachfunction brcmf_fwvid_detach
Annotated Snippet
struct brcmf_fwvid_entry {
const char *name;
const struct brcmf_fwvid_ops *vops;
struct list_head drvr_list;
#if IS_MODULE(CONFIG_BRCMFMAC)
struct module *vmod;
struct completion reg_done;
#endif
};
static DEFINE_MUTEX(fwvid_list_lock);
#if IS_MODULE(CONFIG_BRCMFMAC)
#define FWVID_ENTRY_INIT(_vid, _name) \
[BRCMF_FWVENDOR_ ## _vid] = { \
.name = #_name, \
.reg_done = COMPLETION_INITIALIZER(fwvid_list[BRCMF_FWVENDOR_ ## _vid].reg_done), \
.drvr_list = LIST_HEAD_INIT(fwvid_list[BRCMF_FWVENDOR_ ## _vid].drvr_list), \
}
#else
#define FWVID_ENTRY_INIT(_vid, _name) \
[BRCMF_FWVENDOR_ ## _vid] = { \
.name = #_name, \
.drvr_list = LIST_HEAD_INIT(fwvid_list[BRCMF_FWVENDOR_ ## _vid].drvr_list), \
.vops = _vid ## _VOPS \
}
#endif /* IS_MODULE(CONFIG_BRCMFMAC) */
static struct brcmf_fwvid_entry fwvid_list[BRCMF_FWVENDOR_NUM] = {
FWVID_ENTRY_INIT(WCC, wcc),
FWVID_ENTRY_INIT(CYW, cyw),
FWVID_ENTRY_INIT(BCA, bca),
};
#if IS_MODULE(CONFIG_BRCMFMAC)
static int brcmf_fwvid_request_module(enum brcmf_fwvendor fwvid)
{
int ret;
if (!fwvid_list[fwvid].vmod) {
struct completion *reg_done = &fwvid_list[fwvid].reg_done;
mutex_unlock(&fwvid_list_lock);
ret = request_module("brcmfmac-%s", fwvid_list[fwvid].name);
if (ret)
goto fail;
ret = wait_for_completion_interruptible(reg_done);
if (ret)
goto fail;
mutex_lock(&fwvid_list_lock);
}
return 0;
fail:
brcmf_err("mod=%s: failed %d\n", fwvid_list[fwvid].name, ret);
return ret;
}
int brcmf_fwvid_register_vendor(enum brcmf_fwvendor fwvid, struct module *vmod,
const struct brcmf_fwvid_ops *vops)
{
if (fwvid >= BRCMF_FWVENDOR_NUM)
return -ERANGE;
if (WARN_ON(!vmod) || WARN_ON(!vops) ||
WARN_ON(!vops->alloc_fweh_info))
return -EINVAL;
if (WARN_ON(fwvid_list[fwvid].vmod))
return -EEXIST;
brcmf_dbg(TRACE, "mod=%s: enter\n", fwvid_list[fwvid].name);
mutex_lock(&fwvid_list_lock);
fwvid_list[fwvid].vmod = vmod;
fwvid_list[fwvid].vops = vops;
mutex_unlock(&fwvid_list_lock);
complete_all(&fwvid_list[fwvid].reg_done);
return 0;
}
BRCMF_EXPORT_SYMBOL_GPL(brcmf_fwvid_register_vendor);
int brcmf_fwvid_unregister_vendor(enum brcmf_fwvendor fwvid, struct module *mod)
Annotation
- Immediate include surface: `linux/errno.h`, `linux/export.h`, `linux/module.h`, `linux/kmod.h`, `linux/list.h`, `linux/completion.h`, `linux/mutex.h`, `linux/printk.h`.
- Detected declarations: `struct brcmf_fwvid_entry`, `function brcmf_fwvid_request_module`, `function brcmf_fwvid_register_vendor`, `function brcmf_fwvid_unregister_vendor`, `function list_for_each_entry_safe`, `function brcmf_fwvid_request_module`, `function brcmf_fwvid_attach`, `function brcmf_fwvid_detach`.
- 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.