drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c
Source file repositories/reference/linux-study-clean/drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c- Extension
.c- Size
- 34124 bytes
- Lines
- 1356
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/cdev.hlinux/fs.hlinux/device.hlinux/slab.hlinux/compat.hlinux/miscdevice.hlinux/raspberrypi/vchiq_core.hlinux/raspberrypi/vchiq_arm.hlinux/raspberrypi/vchiq_debugfs.hvchiq_ioctl.h
Detected Declarations
struct vchiq_io_copy_callback_contextstruct vchiq_completion_data32struct vchiq_service_params32struct vchiq_create_service32struct vchiq_element32struct vchiq_queue_message32struct vchiq_queue_bulk_transfer32struct vchiq_await_completion32struct vchiq_dequeue_message32struct vchiq_get_config32function user_service_freefunction close_deliveredfunction vchiq_ioc_copy_element_datafunction vchiq_ioc_queue_messagefunction vchiq_ioc_create_servicefunction vchiq_ioc_dequeue_messagefunction vchiq_irq_queue_bulk_tx_rxfunction list_for_each_entryfunction vchiq_get_user_ptrfunction vchiq_put_completionfunction vchiq_ioc_await_completionfunction vchiq_ioctlfunction vchiq_compat_ioctl_create_servicefunction vchiq_compat_ioctl_queue_messagefunction vchiq_compat_ioctl_queue_bulkfunction vchiq_compat_ioctl_await_completionfunction vchiq_compat_ioctl_dequeue_messagefunction vchiq_compat_ioctl_get_configfunction vchiq_compat_ioctlfunction vchiq_openfunction vchiq_releasefunction vchiq_register_chrdevfunction vchiq_deregister_chrdev
Annotated Snippet
static const struct file_operations
vchiq_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = vchiq_ioctl,
#if defined(CONFIG_COMPAT)
.compat_ioctl = vchiq_compat_ioctl,
#endif
.open = vchiq_open,
.release = vchiq_release,
};
static struct miscdevice vchiq_miscdev = {
.fops = &vchiq_fops,
.minor = MISC_DYNAMIC_MINOR,
.name = "vchiq",
};
/**
* vchiq_register_chrdev - Register the char driver for vchiq
* and create the necessary class and
* device files in userspace.
* @parent: The parent of the char device.
*
* Returns 0 on success else returns the error code.
*/
int vchiq_register_chrdev(struct device *parent)
{
vchiq_miscdev.parent = parent;
return misc_register(&vchiq_miscdev);
}
/**
* vchiq_deregister_chrdev - Deregister and cleanup the vchiq char
* driver and device files
*/
void vchiq_deregister_chrdev(void)
{
misc_deregister(&vchiq_miscdev);
}
Annotation
- Immediate include surface: `linux/cdev.h`, `linux/fs.h`, `linux/device.h`, `linux/slab.h`, `linux/compat.h`, `linux/miscdevice.h`, `linux/raspberrypi/vchiq_core.h`, `linux/raspberrypi/vchiq_arm.h`.
- Detected declarations: `struct vchiq_io_copy_callback_context`, `struct vchiq_completion_data32`, `struct vchiq_service_params32`, `struct vchiq_create_service32`, `struct vchiq_element32`, `struct vchiq_queue_message32`, `struct vchiq_queue_bulk_transfer32`, `struct vchiq_await_completion32`, `struct vchiq_dequeue_message32`, `struct vchiq_get_config32`.
- 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.
- 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.