drivers/net/wireless/intel/iwlegacy/debug.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/iwlegacy/debug.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/intel/iwlegacy/debug.c
Extension
.c
Size
38287 bytes
Lines
1380
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.

Dependency Surface

Detected Declarations

Annotated Snippet

static const struct file_operations il_dbgfs_##name##_ops = {	\
	.read = il_dbgfs_##name##_read,				\
	.open = simple_open,					\
	.llseek = generic_file_llseek,				\
};

#define DEBUGFS_WRITE_FILE_OPS(name)				\
	DEBUGFS_WRITE_FUNC(name);				\
static const struct file_operations il_dbgfs_##name##_ops = {	\
	.write = il_dbgfs_##name##_write,			\
	.open = simple_open,					\
	.llseek = generic_file_llseek,				\
};

#define DEBUGFS_READ_WRITE_FILE_OPS(name)			\
	DEBUGFS_READ_FUNC(name);				\
	DEBUGFS_WRITE_FUNC(name);				\
static const struct file_operations il_dbgfs_##name##_ops = {	\
	.write = il_dbgfs_##name##_write,			\
	.read = il_dbgfs_##name##_read,				\
	.open = simple_open,					\
	.llseek = generic_file_llseek,				\
};

static const char *
il_get_mgmt_string(int cmd)
{
	switch (cmd) {
	IL_CMD(MANAGEMENT_ASSOC_REQ);
	IL_CMD(MANAGEMENT_ASSOC_RESP);
	IL_CMD(MANAGEMENT_REASSOC_REQ);
	IL_CMD(MANAGEMENT_REASSOC_RESP);
	IL_CMD(MANAGEMENT_PROBE_REQ);
	IL_CMD(MANAGEMENT_PROBE_RESP);
	IL_CMD(MANAGEMENT_BEACON);
	IL_CMD(MANAGEMENT_ATIM);
	IL_CMD(MANAGEMENT_DISASSOC);
	IL_CMD(MANAGEMENT_AUTH);
	IL_CMD(MANAGEMENT_DEAUTH);
	IL_CMD(MANAGEMENT_ACTION);
	default:
		return "UNKNOWN";

	}
}

static const char *
il_get_ctrl_string(int cmd)
{
	switch (cmd) {
	IL_CMD(CONTROL_BACK_REQ);
	IL_CMD(CONTROL_BACK);
	IL_CMD(CONTROL_PSPOLL);
	IL_CMD(CONTROL_RTS);
	IL_CMD(CONTROL_CTS);
	IL_CMD(CONTROL_ACK);
	IL_CMD(CONTROL_CFEND);
	IL_CMD(CONTROL_CFENDACK);
	default:
		return "UNKNOWN";

	}
}

static ssize_t
il_dbgfs_tx_stats_read(struct file *file, char __user *user_buf, size_t count,
		       loff_t *ppos)
{

	struct il_priv *il = file->private_data;
	char *buf;
	int pos = 0;

	int cnt;
	ssize_t ret;
	const size_t bufsz =
	    100 + sizeof(char) * 50 * (MANAGEMENT_MAX + CONTROL_MAX);
	buf = kzalloc(bufsz, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;
	pos += scnprintf(buf + pos, bufsz - pos, "Management:\n");
	for (cnt = 0; cnt < MANAGEMENT_MAX; cnt++) {
		pos +=
		    scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n",
			      il_get_mgmt_string(cnt), il->tx_stats.mgmt[cnt]);
	}
	pos += scnprintf(buf + pos, bufsz - pos, "Control\n");
	for (cnt = 0; cnt < CONTROL_MAX; cnt++) {
		pos +=
		    scnprintf(buf + pos, bufsz - pos, "\t%25s\t\t: %u\n",

Annotation

Implementation Notes