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>
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index 9cb082a..059b592 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -92,6 +92,39 @@
 }
 
 /*
+ * 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 @@
 
 	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 @@
 	edac_mc_sysfs_exit();
 
 err_sysfs:
+	edac_subsys_exit();
+
 	return err;
 }
 
@@ -144,6 +183,7 @@
 	edac_workqueue_teardown();
 	edac_mc_sysfs_exit();
 	edac_debugfs_exit();
+	edac_subsys_exit();
 }
 
 /*