summaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_module.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2015-11-27 11:40:43 +0100
committerBorislav Petkov <bp@suse.de>2015-12-11 16:56:39 +0100
commit733476cf207faf574b132523ff2aee78b488ed6b (patch)
treef0d455a00d75370ae2bfef8572ade0c73e748f9c /drivers/edac/edac_module.c
parentEDAC: Robustify workqueues destruction (diff)
downloadlinux-733476cf207faf574b132523ff2aee78b488ed6b.tar.xz
linux-733476cf207faf574b132523ff2aee78b488ed6b.zip
EDAC: Rip out the edac_subsys reference counting
This was really dumb - reference counting for the main EDAC sysfs object. While we could've simply registered it as the first thing in the module init path and then hand it around to what needs it. Do that and rip out all the code around it, thus simplifying the whole handling significantly. Move the edac_subsys node back to edac_module.c. Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac/edac_module.c')
-rw-r--r--drivers/edac/edac_module.c40
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();
}
/*