From 8096cfafbb7ad3cb1a286ae7e8086167f4ebb4b6 Mon Sep 17 00:00:00 2001 From: Doug Thompson Date: Thu, 19 Jul 2007 01:50:27 -0700 Subject: drivers/edac: fix edac_mc sysfs completion code This patch refactors the 'releasing' of kobjects for the edac_mc type of device. The correct pattern of kobject release is followed. As internal kobjs are allocated they bump a ref count on the top level kobj. It in turn has a module ref count on the edac_core module. When internal kobjects are released, they dec the ref count on the top level kobj. When the top level kobj reaches zero, it decrements the ref count on the edac_core object, allow it to be unloaded, as all resources have all now been released. Cc: Alan Cox alan@lxorguk.ukuu.org.uk Signed-off-by: Doug Thompson Acked-by: Greg KH Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/edac/edac_module.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/edac/edac_module.c') diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c index 07bd1656478..fc32bbb9405 100644 --- a/drivers/edac/edac_module.c +++ b/drivers/edac/edac_module.c @@ -14,11 +14,11 @@ #include "edac_core.h" #include "edac_module.h" -#define EDAC_MC_VERSION "Ver: 2.0.4 " __DATE__ +#define EDAC_MC_VERSION "Ver: 2.0.5 " __DATE__ #ifdef CONFIG_EDAC_DEBUG /* Values of 0 to 4 will generate output */ -int edac_debug_level = 1; +int edac_debug_level = 2; EXPORT_SYMBOL_GPL(edac_debug_level); #endif @@ -153,7 +153,7 @@ static int __init edac_init(void) edac_pci_clear_parity_errors(); /* - * perform the registration of the /sys/devices/system/edac object + * perform the registration of the /sys/devices/system/edac class object */ if (edac_register_sysfs_edac_name()) { edac_printk(KERN_ERR, EDAC_MC, @@ -162,29 +162,29 @@ static int __init edac_init(void) goto error; } - /* Create the MC sysfs entries, must be first + /* + * now set up the mc_kset under the edac class object */ - if (edac_sysfs_memctrl_setup()) { - edac_printk(KERN_ERR, EDAC_MC, - "Error initializing sysfs code\n"); - err = -ENODEV; - goto error_sysfs; - } + err = edac_sysfs_setup_mc_kset(); + if (err) + goto sysfs_setup_fail; - /* Setup/Initialize the edac_device system */ + /* Setup/Initialize the workq for this core */ err = edac_workqueue_setup(); if (err) { edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n"); - goto error_mem; + goto workq_fail; } return 0; /* Error teardown stack */ -error_mem: - edac_sysfs_memctrl_teardown(); -error_sysfs: +workq_fail: + edac_sysfs_teardown_mc_kset(); + +sysfs_setup_fail: edac_unregister_sysfs_edac_name(); + error: return err; } @@ -199,7 +199,7 @@ static void __exit edac_exit(void) /* tear down the various subsystems */ edac_workqueue_teardown(); - edac_sysfs_memctrl_teardown(); + edac_sysfs_teardown_mc_kset(); edac_unregister_sysfs_edac_name(); } -- cgit v1.2.3