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.

Dependency Surface

Detected Declarations

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

Implementation Notes