drivers/peci/core.c
Source file repositories/reference/linux-study-clean/drivers/peci/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/peci/core.c- Extension
.c- Size
- 5518 bytes
- Lines
- 236
- Domain
- Driver Families
- Bucket
- drivers/peci
- 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.
- 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/bug.hlinux/device.hlinux/export.hlinux/idr.hlinux/module.hlinux/of.hlinux/peci.hlinux/pm_runtime.hlinux/property.hlinux/slab.hinternal.h
Detected Declarations
function peci_controller_dev_releasefunction peci_controller_scan_devicesfunction unregister_childfunction unregister_controllerfunction devm_peci_controller_addfunction peci_bus_match_device_idfunction peci_bus_device_matchfunction peci_bus_device_probefunction peci_bus_device_removefunction peci_initfunction peci_exitmodule init peci_init
Annotated Snippet
static int peci_bus_device_match(struct device *dev, const struct device_driver *drv)
{
struct peci_device *device = to_peci_device(dev);
const struct peci_driver *peci_drv = to_peci_driver(drv);
if (dev->type != &peci_device_type)
return 0;
return !!peci_bus_match_device_id(peci_drv->id_table, device);
}
static int peci_bus_device_probe(struct device *dev)
{
struct peci_device *device = to_peci_device(dev);
struct peci_driver *driver = to_peci_driver(dev->driver);
return driver->probe(device, peci_bus_match_device_id(driver->id_table, device));
}
static void peci_bus_device_remove(struct device *dev)
{
struct peci_device *device = to_peci_device(dev);
struct peci_driver *driver = to_peci_driver(dev->driver);
if (driver->remove)
driver->remove(device);
}
const struct bus_type peci_bus_type = {
.name = "peci",
.match = peci_bus_device_match,
.probe = peci_bus_device_probe,
.remove = peci_bus_device_remove,
.bus_groups = peci_bus_groups,
};
static int __init peci_init(void)
{
int ret;
ret = bus_register(&peci_bus_type);
if (ret < 0) {
pr_err("peci: failed to register PECI bus type!\n");
return ret;
}
return 0;
}
module_init(peci_init);
static void __exit peci_exit(void)
{
bus_unregister(&peci_bus_type);
}
module_exit(peci_exit);
MODULE_AUTHOR("Jason M Bills <jason.m.bills@linux.intel.com>");
MODULE_AUTHOR("Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>");
MODULE_AUTHOR("Iwona Winiarska <iwona.winiarska@intel.com>");
MODULE_DESCRIPTION("PECI bus core module");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/bug.h`, `linux/device.h`, `linux/export.h`, `linux/idr.h`, `linux/module.h`, `linux/of.h`, `linux/peci.h`, `linux/pm_runtime.h`.
- Detected declarations: `function peci_controller_dev_release`, `function peci_controller_scan_devices`, `function unregister_child`, `function unregister_controller`, `function devm_peci_controller_add`, `function peci_bus_match_device_id`, `function peci_bus_device_match`, `function peci_bus_device_probe`, `function peci_bus_device_remove`, `function peci_init`.
- Atlas domain: Driver Families / drivers/peci.
- 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.