aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_module.c
diff options
context:
space:
mode:
authorDoug Thompson <dougthompson@xmission.com>2007-07-19 04:50:27 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:57 -0400
commit8096cfafbb7ad3cb1a286ae7e8086167f4ebb4b6 (patch)
tree27b859beffef019095db810244f93e10473ea06f /drivers/edac/edac_module.c
parentd45e7823baf655ced91c7987fb4ba9aae990ad6d (diff)
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 <dougthompson@xmission.com> Acked-by: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/edac/edac_module.c')
-rw-r--r--drivers/edac/edac_module.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index 07bd16564780..fc32bbb9405e 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -14,11 +14,11 @@
14#include "edac_core.h" 14#include "edac_core.h"
15#include "edac_module.h" 15#include "edac_module.h"
16 16
17#define EDAC_MC_VERSION "Ver: 2.0.4 " __DATE__ 17#define EDAC_MC_VERSION "Ver: 2.0.5 " __DATE__
18 18
19#ifdef CONFIG_EDAC_DEBUG 19#ifdef CONFIG_EDAC_DEBUG
20/* Values of 0 to 4 will generate output */ 20/* Values of 0 to 4 will generate output */
21int edac_debug_level = 1; 21int edac_debug_level = 2;
22EXPORT_SYMBOL_GPL(edac_debug_level); 22EXPORT_SYMBOL_GPL(edac_debug_level);
23#endif 23#endif
24 24
@@ -153,7 +153,7 @@ static int __init edac_init(void)
153 edac_pci_clear_parity_errors(); 153 edac_pci_clear_parity_errors();
154 154
155 /* 155 /*
156 * perform the registration of the /sys/devices/system/edac object 156 * perform the registration of the /sys/devices/system/edac class object
157 */ 157 */
158 if (edac_register_sysfs_edac_name()) { 158 if (edac_register_sysfs_edac_name()) {
159 edac_printk(KERN_ERR, EDAC_MC, 159 edac_printk(KERN_ERR, EDAC_MC,
@@ -162,29 +162,29 @@ static int __init edac_init(void)
162 goto error; 162 goto error;
163 } 163 }
164 164
165 /* Create the MC sysfs entries, must be first 165 /*
166 * now set up the mc_kset under the edac class object
166 */ 167 */
167 if (edac_sysfs_memctrl_setup()) { 168 err = edac_sysfs_setup_mc_kset();
168 edac_printk(KERN_ERR, EDAC_MC, 169 if (err)
169 "Error initializing sysfs code\n"); 170 goto sysfs_setup_fail;
170 err = -ENODEV;
171 goto error_sysfs;
172 }
173 171
174 /* Setup/Initialize the edac_device system */ 172 /* Setup/Initialize the workq for this core */
175 err = edac_workqueue_setup(); 173 err = edac_workqueue_setup();
176 if (err) { 174 if (err) {
177 edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n"); 175 edac_printk(KERN_ERR, EDAC_MC, "init WorkQueue failure\n");
178 goto error_mem; 176 goto workq_fail;
179 } 177 }
180 178
181 return 0; 179 return 0;
182 180
183 /* Error teardown stack */ 181 /* Error teardown stack */
184error_mem: 182workq_fail:
185 edac_sysfs_memctrl_teardown(); 183 edac_sysfs_teardown_mc_kset();
186error_sysfs: 184
185sysfs_setup_fail:
187 edac_unregister_sysfs_edac_name(); 186 edac_unregister_sysfs_edac_name();
187
188error: 188error:
189 return err; 189 return err;
190} 190}
@@ -199,7 +199,7 @@ static void __exit edac_exit(void)
199 199
200 /* tear down the various subsystems */ 200 /* tear down the various subsystems */
201 edac_workqueue_teardown(); 201 edac_workqueue_teardown();
202 edac_sysfs_memctrl_teardown(); 202 edac_sysfs_teardown_mc_kset();
203 edac_unregister_sysfs_edac_name(); 203 edac_unregister_sysfs_edac_name();
204} 204}
205 205