drivers/net/wireless/ath/wcn36xx/debug.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/wcn36xx/debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/ath/wcn36xx/debug.c- Extension
.c- Size
- 5484 bytes
- Lines
- 214
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/debugfs.hlinux/uaccess.hwcn36xx.hdebug.hpmc.hfirmware.h
Detected Declarations
function Copyrightfunction list_for_each_entryfunction write_file_bool_bmpsfunction list_for_each_entryfunction write_file_dumpfunction read_file_firmware_feature_capsfunction wcn36xx_debugfs_initfunction wcn36xx_debugfs_exit
Annotated Snippet
static const struct file_operations fops_wcn36xx_bmps = {
.open = simple_open,
.read = read_file_bool_bmps,
.write = write_file_bool_bmps,
};
static ssize_t write_file_dump(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wcn36xx *wcn = file->private_data;
char buf[255], *tmp;
int buf_size;
u32 arg[WCN36xx_MAX_DUMP_ARGS];
int i;
memset(buf, 0, sizeof(buf));
memset(arg, 0, sizeof(arg));
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
tmp = buf;
for (i = 0; i < WCN36xx_MAX_DUMP_ARGS; i++) {
char *begin;
begin = strsep(&tmp, " ");
if (begin == NULL)
break;
if (kstrtos32(begin, 0, &arg[i]) != 0)
break;
}
wcn36xx_info("DUMP args is %d %d %d %d %d\n", arg[0], arg[1], arg[2],
arg[3], arg[4]);
wcn36xx_smd_dump_cmd_req(wcn, arg[0], arg[1], arg[2], arg[3], arg[4]);
return count;
}
static const struct file_operations fops_wcn36xx_dump = {
.open = simple_open,
.write = write_file_dump,
};
static ssize_t read_file_firmware_feature_caps(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
struct wcn36xx *wcn = file->private_data;
size_t len = 0, buf_len = 2048;
char *buf;
int i;
int ret;
buf = kzalloc(buf_len, GFP_KERNEL);
if (!buf)
return -ENOMEM;
mutex_lock(&wcn->hal_mutex);
for (i = 0; i < MAX_FEATURE_SUPPORTED; i++) {
if (wcn36xx_firmware_get_feat_caps(wcn->fw_feat_caps, i)) {
len += scnprintf(buf + len, buf_len - len, "%s\n",
wcn36xx_firmware_get_cap_name(i));
}
if (len >= buf_len)
break;
}
mutex_unlock(&wcn->hal_mutex);
ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
kfree(buf);
return ret;
}
static const struct file_operations fops_wcn36xx_firmware_feat_caps = {
.open = simple_open,
.read = read_file_firmware_feature_caps,
};
#define ADD_FILE(name, mode, fop, priv_data) \
do { \
struct dentry *d; \
d = debugfs_create_file(__stringify(name), \
mode, dfs->rootdir, \
priv_data, fop); \
dfs->file_##name.dentry = d; \
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/uaccess.h`, `wcn36xx.h`, `debug.h`, `pmc.h`, `firmware.h`.
- Detected declarations: `function Copyright`, `function list_for_each_entry`, `function write_file_bool_bmps`, `function list_for_each_entry`, `function write_file_dump`, `function read_file_firmware_feature_caps`, `function wcn36xx_debugfs_init`, `function wcn36xx_debugfs_exit`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.