drivers/vfio/mdev/mdev_driver.c
Source file repositories/reference/linux-study-clean/drivers/vfio/mdev/mdev_driver.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/vfio/mdev/mdev_driver.c- Extension
.c- Size
- 1641 bytes
- Lines
- 76
- Domain
- Driver Families
- Bucket
- drivers/vfio
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/iommu.hlinux/mdev.hmdev_private.h
Detected Declarations
function Copyrightfunction mdev_removefunction mdev_matchfunction mdev_register_driverfunction mdev_unregister_driverexport mdev_register_driverexport mdev_unregister_driver
Annotated Snippet
static int mdev_match(struct device *dev, const struct device_driver *drv)
{
/*
* No drivers automatically match. Drivers are only bound by explicit
* device_driver_attach()
*/
return 0;
}
const struct bus_type mdev_bus_type = {
.name = "mdev",
.probe = mdev_probe,
.remove = mdev_remove,
.match = mdev_match,
};
/**
* mdev_register_driver - register a new MDEV driver
* @drv: the driver to register
*
* Returns a negative value on error, otherwise 0.
**/
int mdev_register_driver(struct mdev_driver *drv)
{
if (!drv->device_api)
return -EINVAL;
/* initialize common driver fields */
drv->driver.bus = &mdev_bus_type;
return driver_register(&drv->driver);
}
EXPORT_SYMBOL(mdev_register_driver);
/*
* mdev_unregister_driver - unregister MDEV driver
* @drv: the driver to unregister
*/
void mdev_unregister_driver(struct mdev_driver *drv)
{
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(mdev_unregister_driver);
Annotation
- Immediate include surface: `linux/iommu.h`, `linux/mdev.h`, `mdev_private.h`.
- Detected declarations: `function Copyright`, `function mdev_remove`, `function mdev_match`, `function mdev_register_driver`, `function mdev_unregister_driver`, `export mdev_register_driver`, `export mdev_unregister_driver`.
- Atlas domain: Driver Families / drivers/vfio.
- Implementation status: pattern implementation candidate.
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.