diff options
Diffstat (limited to 'drivers/edac/edac_module.c')
-rw-r--r-- | drivers/edac/edac_module.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c index 9cb082a19d8a..059b5924988b 100644 --- a/drivers/edac/edac_module.c +++ b/drivers/edac/edac_module.c @@ -92,6 +92,39 @@ static void edac_workqueue_teardown(void) } /* + * sysfs object: /sys/devices/system/edac + * need to export to other files + */ +struct bus_type edac_subsys = { + .name = "edac", + .dev_name = "edac", +}; +EXPORT_SYMBOL_GPL(edac_subsys); + +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 */ +struct bus_type *edac_get_sysfs_subsys(void) +{ + return &edac_subsys; +} +EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys); +/* * edac_init * module initialization entry point */ @@ -101,6 +134,10 @@ static int __init edac_init(void) 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 * @@ -129,6 +166,8 @@ err_wq: edac_mc_sysfs_exit(); err_sysfs: + edac_subsys_exit(); + return err; } @@ -144,6 +183,7 @@ static void __exit edac_exit(void) edac_workqueue_teardown(); edac_mc_sysfs_exit(); edac_debugfs_exit(); + edac_subsys_exit(); } /* |