drivers/net/wireless/ti/wlcore/testmode.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ti/wlcore/testmode.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ti/wlcore/testmode.c- Extension
.c- Size
- 8160 bytes
- Lines
- 385
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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
testmode.hlinux/pm_runtime.hlinux/slab.hnet/genetlink.hwlcore.hdebug.hacx.hio.h
Detected Declarations
enum wl1271_tm_commandsenum wl1271_tm_attrsfunction wl1271_tm_cmd_testfunction wl1271_tm_cmd_interrogatefunction wl1271_tm_cmd_configurefunction wl1271_tm_detect_femfunction wl1271_tm_cmd_set_plt_modefunction wl12xx_tm_cmd_get_macfunction wl1271_tm_cmd
Annotated Snippet
if (!skb) {
ret = -ENOMEM;
goto out_sleep;
}
if (nla_put(skb, WL1271_TM_ATTR_DATA, buf_len, buf)) {
kfree_skb(skb);
ret = -EMSGSIZE;
goto out_sleep;
}
ret = cfg80211_testmode_reply(skb);
if (ret < 0)
goto out_sleep;
}
out_sleep:
pm_runtime_put_autosuspend(wl->dev);
out:
mutex_unlock(&wl->mutex);
return ret;
}
static int wl1271_tm_cmd_interrogate(struct wl1271 *wl, struct nlattr *tb[])
{
int ret;
struct wl1271_command *cmd;
struct sk_buff *skb;
u8 ie_id;
wl1271_debug(DEBUG_TESTMODE, "testmode cmd interrogate");
if (!tb[WL1271_TM_ATTR_IE_ID])
return -EINVAL;
ie_id = nla_get_u8(tb[WL1271_TM_ATTR_IE_ID]);
mutex_lock(&wl->mutex);
if (unlikely(wl->state != WLCORE_STATE_ON)) {
ret = -EINVAL;
goto out;
}
ret = pm_runtime_resume_and_get(wl->dev);
if (ret < 0)
goto out;
cmd = kzalloc_obj(*cmd);
if (!cmd) {
ret = -ENOMEM;
goto out_sleep;
}
ret = wl1271_cmd_interrogate(wl, ie_id, cmd,
sizeof(struct acx_header), sizeof(*cmd));
if (ret < 0) {
wl1271_warning("testmode cmd interrogate failed: %d", ret);
goto out_free;
}
skb = cfg80211_testmode_alloc_reply_skb(wl->hw->wiphy, sizeof(*cmd));
if (!skb) {
ret = -ENOMEM;
goto out_free;
}
if (nla_put(skb, WL1271_TM_ATTR_DATA, sizeof(*cmd), cmd)) {
kfree_skb(skb);
ret = -EMSGSIZE;
goto out_free;
}
ret = cfg80211_testmode_reply(skb);
if (ret < 0)
goto out_free;
out_free:
kfree(cmd);
out_sleep:
pm_runtime_put_autosuspend(wl->dev);
out:
mutex_unlock(&wl->mutex);
return ret;
}
static int wl1271_tm_cmd_configure(struct wl1271 *wl, struct nlattr *tb[])
{
Annotation
- Immediate include surface: `testmode.h`, `linux/pm_runtime.h`, `linux/slab.h`, `net/genetlink.h`, `wlcore.h`, `debug.h`, `acx.h`, `io.h`.
- Detected declarations: `enum wl1271_tm_commands`, `enum wl1271_tm_attrs`, `function wl1271_tm_cmd_test`, `function wl1271_tm_cmd_interrogate`, `function wl1271_tm_cmd_configure`, `function wl1271_tm_detect_fem`, `function wl1271_tm_cmd_set_plt_mode`, `function wl12xx_tm_cmd_get_mac`, `function wl1271_tm_cmd`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.