diff options
author | Borislav Petkov <borislav.petkov@amd.com> | 2010-09-02 11:26:48 -0400 |
---|---|---|
committer | Borislav Petkov <bp@amd64.org> | 2010-10-21 08:47:59 -0400 |
commit | 30e1f7a8122145f44f45c95366e27b6bb0b08428 (patch) | |
tree | ad1b549b88319b074505eed41914dd7b70f5434c /drivers/edac/edac_device_sysfs.c | |
parent | 7cfd4a87441f5ca3018fdd1f7ad67e8a73a05dc2 (diff) |
EDAC: Export edac sysfs class to users.
Move toplevel sysfs class to the stub and make it available to
non-modularized code too. Add proper refcounting of its users and move
the registration functionality into the reference counting routines.
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'drivers/edac/edac_device_sysfs.c')
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index 070968178a24..2941dca91aae 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/ctype.h> | 13 | #include <linux/ctype.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/edac.h> | ||
16 | 17 | ||
17 | #include "edac_core.h" | 18 | #include "edac_core.h" |
18 | #include "edac_module.h" | 19 | #include "edac_module.h" |
@@ -235,7 +236,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) | |||
235 | debugf1("%s()\n", __func__); | 236 | debugf1("%s()\n", __func__); |
236 | 237 | ||
237 | /* get the /sys/devices/system/edac reference */ | 238 | /* get the /sys/devices/system/edac reference */ |
238 | edac_class = edac_get_edac_class(); | 239 | edac_class = edac_get_sysfs_class(); |
239 | if (edac_class == NULL) { | 240 | if (edac_class == NULL) { |
240 | debugf1("%s() no edac_class error\n", __func__); | 241 | debugf1("%s() no edac_class error\n", __func__); |
241 | err = -ENODEV; | 242 | err = -ENODEV; |
@@ -255,7 +256,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) | |||
255 | 256 | ||
256 | if (!try_module_get(edac_dev->owner)) { | 257 | if (!try_module_get(edac_dev->owner)) { |
257 | err = -ENODEV; | 258 | err = -ENODEV; |
258 | goto err_out; | 259 | goto err_mod_get; |
259 | } | 260 | } |
260 | 261 | ||
261 | /* register */ | 262 | /* register */ |
@@ -282,6 +283,9 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) | |||
282 | err_kobj_reg: | 283 | err_kobj_reg: |
283 | module_put(edac_dev->owner); | 284 | module_put(edac_dev->owner); |
284 | 285 | ||
286 | err_mod_get: | ||
287 | edac_put_sysfs_class(); | ||
288 | |||
285 | err_out: | 289 | err_out: |
286 | return err; | 290 | return err; |
287 | } | 291 | } |
@@ -290,12 +294,11 @@ err_out: | |||
290 | * edac_device_unregister_sysfs_main_kobj: | 294 | * edac_device_unregister_sysfs_main_kobj: |
291 | * the '..../edac/<name>' kobject | 295 | * the '..../edac/<name>' kobject |
292 | */ | 296 | */ |
293 | void edac_device_unregister_sysfs_main_kobj( | 297 | void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev) |
294 | struct edac_device_ctl_info *edac_dev) | ||
295 | { | 298 | { |
296 | debugf0("%s()\n", __func__); | 299 | debugf0("%s()\n", __func__); |
297 | debugf4("%s() name of kobject is: %s\n", | 300 | debugf4("%s() name of kobject is: %s\n", |
298 | __func__, kobject_name(&edac_dev->kobj)); | 301 | __func__, kobject_name(&dev->kobj)); |
299 | 302 | ||
300 | /* | 303 | /* |
301 | * Unregister the edac device's kobject and | 304 | * Unregister the edac device's kobject and |
@@ -304,7 +307,8 @@ void edac_device_unregister_sysfs_main_kobj( | |||
304 | * a) module_put() this module | 307 | * a) module_put() this module |
305 | * b) 'kfree' the memory | 308 | * b) 'kfree' the memory |
306 | */ | 309 | */ |
307 | kobject_put(&edac_dev->kobj); | 310 | kobject_put(&dev->kobj); |
311 | edac_put_sysfs_class(); | ||
308 | } | 312 | } |
309 | 313 | ||
310 | /* edac_dev -> instance information */ | 314 | /* edac_dev -> instance information */ |