drivers/platform/raspberrypi/vchiq-interface/vchiq_debugfs.c
Source file repositories/reference/linux-study-clean/drivers/platform/raspberrypi/vchiq-interface/vchiq_debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/raspberrypi/vchiq-interface/vchiq_debugfs.c- Extension
.c- Size
- 3547 bytes
- Lines
- 158
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/raspberrypi/vchiq_core.hlinux/raspberrypi/vchiq_arm.hlinux/raspberrypi/vchiq_debugfs.h
Detected Declarations
function debugfs_usecount_showfunction debugfs_trace_showfunction vchiq_dump_showfunction debugfs_trace_openfunction debugfs_trace_writefunction vchiq_debugfs_add_instancefunction vchiq_debugfs_remove_instancefunction vchiq_debugfs_initfunction vchiq_debugfs_deinitfunction vchiq_debugfs_init
Annotated Snippet
static const struct file_operations debugfs_trace_fops = {
.owner = THIS_MODULE,
.open = debugfs_trace_open,
.write = debugfs_trace_write,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
/* add an instance (process) to the debugfs entries */
void vchiq_debugfs_add_instance(struct vchiq_instance *instance)
{
char pidstr[16];
struct dentry *top;
snprintf(pidstr, sizeof(pidstr), "%d",
vchiq_instance_get_pid(instance));
top = debugfs_create_dir(pidstr, vchiq_dbg_clients);
debugfs_create_file("use_count", 0444, top, instance,
&debugfs_usecount_fops);
debugfs_create_file("trace", 0644, top, instance, &debugfs_trace_fops);
vchiq_instance_get_debugfs_node(instance)->dentry = top;
}
void vchiq_debugfs_remove_instance(struct vchiq_instance *instance)
{
struct vchiq_debugfs_node *node =
vchiq_instance_get_debugfs_node(instance);
debugfs_remove_recursive(node->dentry);
}
void vchiq_debugfs_init(struct vchiq_state *state)
{
vchiq_dbg_dir = debugfs_create_dir("vchiq", NULL);
vchiq_dbg_clients = debugfs_create_dir("clients", vchiq_dbg_dir);
debugfs_create_file("state", S_IFREG | 0444, vchiq_dbg_dir, state,
&vchiq_dump_fops);
}
/* remove all the debugfs entries */
void vchiq_debugfs_deinit(void)
{
debugfs_remove_recursive(vchiq_dbg_dir);
}
#else /* CONFIG_DEBUG_FS */
void vchiq_debugfs_init(struct vchiq_state *state)
{
}
void vchiq_debugfs_deinit(void)
{
}
void vchiq_debugfs_add_instance(struct vchiq_instance *instance)
{
}
void vchiq_debugfs_remove_instance(struct vchiq_instance *instance)
{
}
#endif /* CONFIG_DEBUG_FS */
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/raspberrypi/vchiq_core.h`, `linux/raspberrypi/vchiq_arm.h`, `linux/raspberrypi/vchiq_debugfs.h`.
- Detected declarations: `function debugfs_usecount_show`, `function debugfs_trace_show`, `function vchiq_dump_show`, `function debugfs_trace_open`, `function debugfs_trace_write`, `function vchiq_debugfs_add_instance`, `function vchiq_debugfs_remove_instance`, `function vchiq_debugfs_init`, `function vchiq_debugfs_deinit`, `function vchiq_debugfs_init`.
- Atlas domain: Driver Families / drivers/platform.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.