drivers/bluetooth/btmrvl_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/bluetooth/btmrvl_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bluetooth/btmrvl_debugfs.c- Extension
.c- Size
- 4821 bytes
- Lines
- 194
- Domain
- Driver Families
- Bucket
- drivers/bluetooth
- 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.
- 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/slab.hnet/bluetooth/bluetooth.hnet/bluetooth/hci_core.hbtmrvl_drv.h
Detected Declarations
struct btmrvl_debugfs_datafunction btmrvl_hscfgcmd_writefunction btmrvl_hscfgcmd_readfunction btmrvl_pscmd_writefunction btmrvl_pscmd_readfunction btmrvl_hscmd_writefunction btmrvl_hscmd_readfunction btmrvl_debugfs_initfunction btmrvl_debugfs_remove
Annotated Snippet
static const struct file_operations btmrvl_hscfgcmd_fops = {
.read = btmrvl_hscfgcmd_read,
.write = btmrvl_hscfgcmd_write,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
long result, ret;
ret = kstrtol_from_user(ubuf, count, 10, &result);
if (ret)
return ret;
priv->btmrvl_dev.pscmd = result;
if (priv->btmrvl_dev.pscmd) {
btmrvl_prepare_command(priv);
wake_up_interruptible(&priv->main_thread.wait_q);
}
return count;
}
static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
char buf[16];
int ret;
ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.pscmd);
return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
}
static const struct file_operations btmrvl_pscmd_fops = {
.read = btmrvl_pscmd_read,
.write = btmrvl_pscmd_write,
.open = simple_open,
.llseek = default_llseek,
};
static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf,
size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
long result, ret;
ret = kstrtol_from_user(ubuf, count, 10, &result);
if (ret)
return ret;
priv->btmrvl_dev.hscmd = result;
if (priv->btmrvl_dev.hscmd) {
btmrvl_prepare_command(priv);
wake_up_interruptible(&priv->main_thread.wait_q);
}
return count;
}
static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf,
size_t count, loff_t *ppos)
{
struct btmrvl_private *priv = file->private_data;
char buf[16];
int ret;
ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hscmd);
return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
}
static const struct file_operations btmrvl_hscmd_fops = {
.read = btmrvl_hscmd_read,
.write = btmrvl_hscmd_write,
.open = simple_open,
.llseek = default_llseek,
};
void btmrvl_debugfs_init(struct hci_dev *hdev)
{
struct btmrvl_private *priv = hci_get_drvdata(hdev);
struct btmrvl_debugfs_data *dbg;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/slab.h`, `net/bluetooth/bluetooth.h`, `net/bluetooth/hci_core.h`, `btmrvl_drv.h`.
- Detected declarations: `struct btmrvl_debugfs_data`, `function btmrvl_hscfgcmd_write`, `function btmrvl_hscfgcmd_read`, `function btmrvl_pscmd_write`, `function btmrvl_pscmd_read`, `function btmrvl_hscmd_write`, `function btmrvl_hscmd_read`, `function btmrvl_debugfs_init`, `function btmrvl_debugfs_remove`.
- Atlas domain: Driver Families / drivers/bluetooth.
- Implementation status: pattern implementation candidate.
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.