drivers/net/wireless/ath/wil6210/debugfs.c

Source file repositories/reference/linux-study-clean/drivers/net/wireless/ath/wil6210/debugfs.c

File Facts

System
Linux kernel
Corpus path
drivers/net/wireless/ath/wil6210/debugfs.c
Extension
.c
Size
63544 bytes
Lines
2487
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 fops_ioblob = {
	.read =		wil_read_file_ioblob,
	.open =		simple_open,
	.llseek =	default_llseek,
};

static
struct dentry *wil_debugfs_create_ioblob(const char *name,
					 umode_t mode,
					 struct dentry *parent,
					 struct wil_blob_wrapper *wil_blob)
{
	return debugfs_create_file(name, mode, parent, wil_blob, &fops_ioblob);
}

/*---write channel 1..4 to rxon for it, 0 to rxoff---*/
static ssize_t wil_write_file_rxon(struct file *file, const char __user *buf,
				   size_t len, loff_t *ppos)
{
	struct wil6210_priv *wil = file->private_data;
	int rc;
	long channel;
	bool on;

	char *kbuf = memdup_user_nul(buf, len);

	if (IS_ERR(kbuf))
		return PTR_ERR(kbuf);
	rc = kstrtol(kbuf, 0, &channel);
	kfree(kbuf);
	if (rc)
		return rc;

	if ((channel < 0) || (channel > 4)) {
		wil_err(wil, "Invalid channel %ld\n", channel);
		return -EINVAL;
	}
	on = !!channel;

	if (on) {
		rc = wmi_set_channel(wil, (int)channel);
		if (rc)
			return rc;
	}

	rc = wmi_rxon(wil, on);
	if (rc)
		return rc;

	return len;
}

static const struct file_operations fops_rxon = {
	.write = wil_write_file_rxon,
	.open  = simple_open,
};

static ssize_t wil_write_file_rbufcap(struct file *file,
				      const char __user *buf,
				      size_t count, loff_t *ppos)
{
	struct wil6210_priv *wil = file->private_data;
	int val;
	int rc;

	rc = kstrtoint_from_user(buf, count, 0, &val);
	if (rc) {
		wil_err(wil, "Invalid argument\n");
		return rc;
	}
	/* input value: negative to disable, 0 to use system default,
	 * 1..ring size to set descriptor threshold
	 */
	wil_info(wil, "%s RBUFCAP, descriptors threshold - %d\n",
		 val < 0 ? "Disabling" : "Enabling", val);

	if (!wil->ring_rx.va || val > wil->ring_rx.size) {
		wil_err(wil, "Invalid descriptors threshold, %d\n", val);
		return -EINVAL;
	}

	rc = wmi_rbufcap_cfg(wil, val < 0 ? 0 : 1, val < 0 ? 0 : val);
	if (rc) {
		wil_err(wil, "RBUFCAP config failed: %d\n", rc);
		return rc;
	}

	return count;
}

Annotation

Implementation Notes