drivers/edac/edac_module.c
Source file repositories/reference/linux-study-clean/drivers/edac/edac_module.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/edac/edac_module.c- Extension
.c- Size
- 3380 bytes
- Lines
- 169
- Domain
- Driver Families
- Bucket
- drivers/edac
- 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/edac.hedac_mc.hedac_module.h
Detected Declarations
function edac_set_debug_levelfunction edac_op_state_to_stringfunction edac_subsys_initfunction edac_subsys_exitfunction edac_initfunction edac_exitmodule init edac_initexport edac_debug_levelexport edac_get_sysfs_subsys
Annotated Snippet
static const struct bus_type edac_subsys = {
.name = "edac",
.dev_name = "edac",
};
static int edac_subsys_init(void)
{
int err;
/* create the /sys/devices/system/edac directory */
err = subsys_system_register(&edac_subsys, NULL);
if (err)
printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n");
return err;
}
static void edac_subsys_exit(void)
{
bus_unregister(&edac_subsys);
}
/* return pointer to the 'edac' node in sysfs */
const struct bus_type *edac_get_sysfs_subsys(void)
{
return &edac_subsys;
}
EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys);
/*
* edac_init
* module initialization entry point
*/
static int __init edac_init(void)
{
int err = 0;
edac_printk(KERN_INFO, EDAC_MC, EDAC_VERSION "\n");
err = edac_subsys_init();
if (err)
return err;
/*
* Harvest and clear any boot/initialization PCI parity errors
*
* FIXME: This only clears errors logged by devices present at time of
* module initialization. We should also do an initial clear
* of each newly hotplugged device.
*/
edac_pci_clear_parity_errors();
err = edac_mc_sysfs_init();
if (err)
goto err_sysfs;
edac_debugfs_init();
err = edac_workqueue_setup();
if (err) {
edac_printk(KERN_ERR, EDAC_MC, "Failure initializing workqueue\n");
goto err_wq;
}
return 0;
err_wq:
edac_debugfs_exit();
edac_mc_sysfs_exit();
err_sysfs:
edac_subsys_exit();
return err;
}
/*
* edac_exit()
* module exit/termination function
*/
static void __exit edac_exit(void)
{
edac_dbg(0, "\n");
/* tear down the various subsystems */
edac_workqueue_teardown();
edac_mc_sysfs_exit();
edac_debugfs_exit();
edac_subsys_exit();
}
Annotation
- Immediate include surface: `linux/edac.h`, `edac_mc.h`, `edac_module.h`.
- Detected declarations: `function edac_set_debug_level`, `function edac_op_state_to_string`, `function edac_subsys_init`, `function edac_subsys_exit`, `function edac_init`, `function edac_exit`, `module init edac_init`, `export edac_debug_level`, `export edac_get_sysfs_subsys`.
- Atlas domain: Driver Families / drivers/edac.
- 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.