drivers/rapidio/rio-driver.c
Source file repositories/reference/linux-study-clean/drivers/rapidio/rio-driver.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/rapidio/rio-driver.c- Extension
.c- Size
- 6828 bytes
- Lines
- 267
- Domain
- Driver Families
- Bucket
- drivers/rapidio
- 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/init.hlinux/module.hlinux/rio.hlinux/rio_ids.hlinux/rio_drv.hrio.h
Detected Declarations
function probefunction rio_dev_putfunction rio_device_probefunction rio_device_removefunction rio_device_shutdownfunction rio_register_driverfunction rio_unregister_driverfunction rio_attach_devicefunction rio_match_busfunction rio_ueventfunction rio_bus_initexport rio_attach_deviceexport rio_mport_classexport rio_register_driverexport rio_unregister_driverexport rio_bus_typeexport rio_dev_getexport rio_dev_put
Annotated Snippet
static int rio_match_bus(struct device *dev, const struct device_driver *drv)
{
struct rio_dev *rdev = to_rio_dev(dev);
const struct rio_driver *rdrv = to_rio_driver(drv);
const struct rio_device_id *id = rdrv->id_table;
const struct rio_device_id *found_id;
if (!id)
goto out;
found_id = rio_match_device(id, rdev);
if (found_id)
return 1;
out:return 0;
}
static int rio_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct rio_dev *rdev;
if (!dev)
return -ENODEV;
rdev = to_rio_dev(dev);
if (!rdev)
return -ENODEV;
if (add_uevent_var(env, "MODALIAS=rapidio:v%04Xd%04Xav%04Xad%04X",
rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did))
return -ENOMEM;
return 0;
}
struct class rio_mport_class = {
.name = "rapidio_port",
.dev_groups = rio_mport_groups,
};
EXPORT_SYMBOL_GPL(rio_mport_class);
const struct bus_type rio_bus_type = {
.name = "rapidio",
.match = rio_match_bus,
.dev_groups = rio_dev_groups,
.bus_groups = rio_bus_groups,
.probe = rio_device_probe,
.remove = rio_device_remove,
.shutdown = rio_device_shutdown,
.uevent = rio_uevent,
};
/**
* rio_bus_init - Register the RapidIO bus with the device model
*
* Registers the RIO mport device class and RIO bus type with the Linux
* device model.
*/
static int __init rio_bus_init(void)
{
int ret;
ret = class_register(&rio_mport_class);
if (!ret) {
ret = bus_register(&rio_bus_type);
if (ret)
class_unregister(&rio_mport_class);
}
return ret;
}
postcore_initcall(rio_bus_init);
EXPORT_SYMBOL_GPL(rio_register_driver);
EXPORT_SYMBOL_GPL(rio_unregister_driver);
EXPORT_SYMBOL_GPL(rio_bus_type);
EXPORT_SYMBOL_GPL(rio_dev_get);
EXPORT_SYMBOL_GPL(rio_dev_put);
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/rio.h`, `linux/rio_ids.h`, `linux/rio_drv.h`, `rio.h`.
- Detected declarations: `function probe`, `function rio_dev_put`, `function rio_device_probe`, `function rio_device_remove`, `function rio_device_shutdown`, `function rio_register_driver`, `function rio_unregister_driver`, `function rio_attach_device`, `function rio_match_bus`, `function rio_uevent`.
- Atlas domain: Driver Families / drivers/rapidio.
- 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.