drivers/bus/mhi/host/debugfs.c
Source file repositories/reference/linux-study-clean/drivers/bus/mhi/host/debugfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/mhi/host/debugfs.c- Extension
.c- Size
- 11540 bytes
- Lines
- 415
- Domain
- Driver Families
- Bucket
- drivers/bus
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/debugfs.hlinux/device.hlinux/interrupt.hlinux/list.hlinux/mhi.hlinux/module.hlinux/string_choices.hinternal.h
Detected Declarations
function Copyrightfunction mhi_debugfs_events_showfunction mhi_debugfs_channels_showfunction mhi_device_info_showfunction mhi_debugfs_devices_showfunction mhi_debugfs_regdump_showfunction mhi_debugfs_device_wake_showfunction mhi_debugfs_device_wake_writefunction mhi_debugfs_timeout_ms_showfunction mhi_debugfs_timeout_ms_writefunction mhi_debugfs_states_openfunction mhi_debugfs_events_openfunction mhi_debugfs_channels_openfunction mhi_debugfs_devices_openfunction mhi_debugfs_regdump_openfunction mhi_debugfs_device_wake_openfunction mhi_debugfs_timeout_ms_openfunction mhi_create_debugfsfunction mhi_destroy_debugfsfunction mhi_debugfs_initfunction mhi_debugfs_exit
Annotated Snippet
static const struct file_operations debugfs_states_fops = {
.open = mhi_debugfs_states_open,
.release = single_release,
.read = seq_read,
};
static const struct file_operations debugfs_events_fops = {
.open = mhi_debugfs_events_open,
.release = single_release,
.read = seq_read,
};
static const struct file_operations debugfs_channels_fops = {
.open = mhi_debugfs_channels_open,
.release = single_release,
.read = seq_read,
};
static const struct file_operations debugfs_devices_fops = {
.open = mhi_debugfs_devices_open,
.release = single_release,
.read = seq_read,
};
static const struct file_operations debugfs_regdump_fops = {
.open = mhi_debugfs_regdump_open,
.release = single_release,
.read = seq_read,
};
static const struct file_operations debugfs_device_wake_fops = {
.open = mhi_debugfs_device_wake_open,
.write = mhi_debugfs_device_wake_write,
.release = single_release,
.read = seq_read,
};
static const struct file_operations debugfs_timeout_ms_fops = {
.open = mhi_debugfs_timeout_ms_open,
.write = mhi_debugfs_timeout_ms_write,
.release = single_release,
.read = seq_read,
};
static struct dentry *mhi_debugfs_root;
void mhi_create_debugfs(struct mhi_controller *mhi_cntrl)
{
mhi_cntrl->debugfs_dentry =
debugfs_create_dir(dev_name(&mhi_cntrl->mhi_dev->dev),
mhi_debugfs_root);
debugfs_create_file("states", 0444, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_states_fops);
debugfs_create_file("events", 0444, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_events_fops);
debugfs_create_file("channels", 0444, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_channels_fops);
debugfs_create_file("devices", 0444, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_devices_fops);
debugfs_create_file("regdump", 0444, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_regdump_fops);
debugfs_create_file("device_wake", 0644, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_device_wake_fops);
debugfs_create_file("timeout_ms", 0644, mhi_cntrl->debugfs_dentry,
mhi_cntrl, &debugfs_timeout_ms_fops);
}
void mhi_destroy_debugfs(struct mhi_controller *mhi_cntrl)
{
debugfs_remove_recursive(mhi_cntrl->debugfs_dentry);
mhi_cntrl->debugfs_dentry = NULL;
}
void mhi_debugfs_init(void)
{
mhi_debugfs_root = debugfs_create_dir(mhi_bus_type.name, NULL);
}
void mhi_debugfs_exit(void)
{
debugfs_remove_recursive(mhi_debugfs_root);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/device.h`, `linux/interrupt.h`, `linux/list.h`, `linux/mhi.h`, `linux/module.h`, `linux/string_choices.h`, `internal.h`.
- Detected declarations: `function Copyright`, `function mhi_debugfs_events_show`, `function mhi_debugfs_channels_show`, `function mhi_device_info_show`, `function mhi_debugfs_devices_show`, `function mhi_debugfs_regdump_show`, `function mhi_debugfs_device_wake_show`, `function mhi_debugfs_device_wake_write`, `function mhi_debugfs_timeout_ms_show`, `function mhi_debugfs_timeout_ms_write`.
- Atlas domain: Driver Families / drivers/bus.
- 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.