drivers/hid/hid-debug.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-debug.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-debug.c- Extension
.c- Size
- 149496 bytes
- Lines
- 3841
- Domain
- Driver Families
- Bucket
- drivers/hid
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/seq_file.hlinux/kfifo.hlinux/sched/signal.hlinux/export.hlinux/slab.hlinux/uaccess.hlinux/poll.hlinux/hid.hlinux/hid-debug.h
Detected Declarations
struct hid_usage_entryfunction resolv_usage_pagefunction tabfunction hid_dump_fieldfunction hid_dump_devicefunction hid_debug_eventfunction hid_dump_reportfunction hid_dump_inputfunction hid_resolv_eventfunction hid_dump_input_mappingfunction list_for_each_entryfunction hid_debug_rdesc_showfunction hid_debug_events_openfunction hid_debug_events_readfunction remove_wait_queuefunction hid_debug_events_pollfunction hid_debug_events_releasefunction hid_debug_registerfunction hid_debug_unregisterfunction hid_debug_initfunction hid_debug_exitexport hid_resolv_usageexport hid_dump_fieldexport hid_dump_deviceexport hid_debug_eventexport hid_dump_reportexport hid_dump_input
Annotated Snippet
static const struct file_operations hid_debug_events_fops = {
.owner = THIS_MODULE,
.open = hid_debug_events_open,
.read = hid_debug_events_read,
.poll = hid_debug_events_poll,
.release = hid_debug_events_release,
.llseek = noop_llseek,
};
void hid_debug_register(struct hid_device *hdev, const char *name)
{
hdev->debug_dir = debugfs_create_dir(name, hid_debug_root);
hdev->debug_rdesc = debugfs_create_file("rdesc", 0400,
hdev->debug_dir, hdev, &hid_debug_rdesc_fops);
hdev->debug_events = debugfs_create_file("events", 0400,
hdev->debug_dir, hdev, &hid_debug_events_fops);
hdev->debug = 1;
}
void hid_debug_unregister(struct hid_device *hdev)
{
hdev->debug = 0;
wake_up_interruptible(&hdev->debug_wait);
debugfs_remove(hdev->debug_rdesc);
debugfs_remove(hdev->debug_events);
debugfs_remove(hdev->debug_dir);
}
void hid_debug_init(void)
{
hid_debug_root = debugfs_create_dir("hid", NULL);
}
void hid_debug_exit(void)
{
debugfs_remove_recursive(hid_debug_root);
}
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/seq_file.h`, `linux/kfifo.h`, `linux/sched/signal.h`, `linux/export.h`, `linux/slab.h`, `linux/uaccess.h`, `linux/poll.h`.
- Detected declarations: `struct hid_usage_entry`, `function resolv_usage_page`, `function tab`, `function hid_dump_field`, `function hid_dump_device`, `function hid_debug_event`, `function hid_dump_report`, `function hid_dump_input`, `function hid_resolv_event`, `function hid_dump_input_mapping`.
- Atlas domain: Driver Families / drivers/hid.
- Implementation status: pattern implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.