diff options
Diffstat (limited to 'drivers/edac/edac_device_sysfs.c')
-rw-r--r-- | drivers/edac/edac_device_sysfs.c | 71 |
1 files changed, 32 insertions, 39 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c index b4ea185ccebf..fb68a06ad683 100644 --- a/drivers/edac/edac_device_sysfs.c +++ b/drivers/edac/edac_device_sysfs.c | |||
@@ -202,7 +202,7 @@ static void edac_device_ctrl_master_release(struct kobject *kobj) | |||
202 | { | 202 | { |
203 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); | 203 | struct edac_device_ctl_info *edac_dev = to_edacdev(kobj); |
204 | 204 | ||
205 | debugf4("%s() control index=%d\n", __func__, edac_dev->dev_idx); | 205 | edac_dbg(4, "control index=%d\n", edac_dev->dev_idx); |
206 | 206 | ||
207 | /* decrement the EDAC CORE module ref count */ | 207 | /* decrement the EDAC CORE module ref count */ |
208 | module_put(edac_dev->owner); | 208 | module_put(edac_dev->owner); |
@@ -233,12 +233,12 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) | |||
233 | struct bus_type *edac_subsys; | 233 | struct bus_type *edac_subsys; |
234 | int err; | 234 | int err; |
235 | 235 | ||
236 | debugf1("%s()\n", __func__); | 236 | edac_dbg(1, "\n"); |
237 | 237 | ||
238 | /* get the /sys/devices/system/edac reference */ | 238 | /* get the /sys/devices/system/edac reference */ |
239 | edac_subsys = edac_get_sysfs_subsys(); | 239 | edac_subsys = edac_get_sysfs_subsys(); |
240 | if (edac_subsys == NULL) { | 240 | if (edac_subsys == NULL) { |
241 | debugf1("%s() no edac_subsys error\n", __func__); | 241 | edac_dbg(1, "no edac_subsys error\n"); |
242 | err = -ENODEV; | 242 | err = -ENODEV; |
243 | goto err_out; | 243 | goto err_out; |
244 | } | 244 | } |
@@ -264,8 +264,8 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) | |||
264 | &edac_subsys->dev_root->kobj, | 264 | &edac_subsys->dev_root->kobj, |
265 | "%s", edac_dev->name); | 265 | "%s", edac_dev->name); |
266 | if (err) { | 266 | if (err) { |
267 | debugf1("%s()Failed to register '.../edac/%s'\n", | 267 | edac_dbg(1, "Failed to register '.../edac/%s'\n", |
268 | __func__, edac_dev->name); | 268 | edac_dev->name); |
269 | goto err_kobj_reg; | 269 | goto err_kobj_reg; |
270 | } | 270 | } |
271 | kobject_uevent(&edac_dev->kobj, KOBJ_ADD); | 271 | kobject_uevent(&edac_dev->kobj, KOBJ_ADD); |
@@ -274,8 +274,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) | |||
274 | * edac_device_unregister_sysfs_main_kobj() must be used | 274 | * edac_device_unregister_sysfs_main_kobj() must be used |
275 | */ | 275 | */ |
276 | 276 | ||
277 | debugf4("%s() Registered '.../edac/%s' kobject\n", | 277 | edac_dbg(4, "Registered '.../edac/%s' kobject\n", edac_dev->name); |
278 | __func__, edac_dev->name); | ||
279 | 278 | ||
280 | return 0; | 279 | return 0; |
281 | 280 | ||
@@ -296,9 +295,8 @@ err_out: | |||
296 | */ | 295 | */ |
297 | void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev) | 296 | void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev) |
298 | { | 297 | { |
299 | debugf0("%s()\n", __func__); | 298 | edac_dbg(0, "\n"); |
300 | debugf4("%s() name of kobject is: %s\n", | 299 | edac_dbg(4, "name of kobject is: %s\n", kobject_name(&dev->kobj)); |
301 | __func__, kobject_name(&dev->kobj)); | ||
302 | 300 | ||
303 | /* | 301 | /* |
304 | * Unregister the edac device's kobject and | 302 | * Unregister the edac device's kobject and |
@@ -336,7 +334,7 @@ static void edac_device_ctrl_instance_release(struct kobject *kobj) | |||
336 | { | 334 | { |
337 | struct edac_device_instance *instance; | 335 | struct edac_device_instance *instance; |
338 | 336 | ||
339 | debugf1("%s()\n", __func__); | 337 | edac_dbg(1, "\n"); |
340 | 338 | ||
341 | /* map from this kobj to the main control struct | 339 | /* map from this kobj to the main control struct |
342 | * and then dec the main kobj count | 340 | * and then dec the main kobj count |
@@ -442,7 +440,7 @@ static void edac_device_ctrl_block_release(struct kobject *kobj) | |||
442 | { | 440 | { |
443 | struct edac_device_block *block; | 441 | struct edac_device_block *block; |
444 | 442 | ||
445 | debugf1("%s()\n", __func__); | 443 | edac_dbg(1, "\n"); |
446 | 444 | ||
447 | /* get the container of the kobj */ | 445 | /* get the container of the kobj */ |
448 | block = to_block(kobj); | 446 | block = to_block(kobj); |
@@ -524,10 +522,10 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev, | |||
524 | struct edac_dev_sysfs_block_attribute *sysfs_attrib; | 522 | struct edac_dev_sysfs_block_attribute *sysfs_attrib; |
525 | struct kobject *main_kobj; | 523 | struct kobject *main_kobj; |
526 | 524 | ||
527 | debugf4("%s() Instance '%s' inst_p=%p block '%s' block_p=%p\n", | 525 | edac_dbg(4, "Instance '%s' inst_p=%p block '%s' block_p=%p\n", |
528 | __func__, instance->name, instance, block->name, block); | 526 | instance->name, instance, block->name, block); |
529 | debugf4("%s() block kobj=%p block kobj->parent=%p\n", | 527 | edac_dbg(4, "block kobj=%p block kobj->parent=%p\n", |
530 | __func__, &block->kobj, &block->kobj.parent); | 528 | &block->kobj, &block->kobj.parent); |
531 | 529 | ||
532 | /* init this block's kobject */ | 530 | /* init this block's kobject */ |
533 | memset(&block->kobj, 0, sizeof(struct kobject)); | 531 | memset(&block->kobj, 0, sizeof(struct kobject)); |
@@ -546,8 +544,7 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev, | |||
546 | &instance->kobj, | 544 | &instance->kobj, |
547 | "%s", block->name); | 545 | "%s", block->name); |
548 | if (err) { | 546 | if (err) { |
549 | debugf1("%s() Failed to register instance '%s'\n", | 547 | edac_dbg(1, "Failed to register instance '%s'\n", block->name); |
550 | __func__, block->name); | ||
551 | kobject_put(main_kobj); | 548 | kobject_put(main_kobj); |
552 | err = -ENODEV; | 549 | err = -ENODEV; |
553 | goto err_out; | 550 | goto err_out; |
@@ -560,11 +557,9 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev, | |||
560 | if (sysfs_attrib && block->nr_attribs) { | 557 | if (sysfs_attrib && block->nr_attribs) { |
561 | for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) { | 558 | for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) { |
562 | 559 | ||
563 | debugf4("%s() creating block attrib='%s' " | 560 | edac_dbg(4, "creating block attrib='%s' attrib->%p to kobj=%p\n", |
564 | "attrib->%p to kobj=%p\n", | 561 | sysfs_attrib->attr.name, |
565 | __func__, | 562 | sysfs_attrib, &block->kobj); |
566 | sysfs_attrib->attr.name, | ||
567 | sysfs_attrib, &block->kobj); | ||
568 | 563 | ||
569 | /* Create each block_attribute file */ | 564 | /* Create each block_attribute file */ |
570 | err = sysfs_create_file(&block->kobj, | 565 | err = sysfs_create_file(&block->kobj, |
@@ -647,14 +642,14 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev, | |||
647 | err = kobject_init_and_add(&instance->kobj, &ktype_instance_ctrl, | 642 | err = kobject_init_and_add(&instance->kobj, &ktype_instance_ctrl, |
648 | &edac_dev->kobj, "%s", instance->name); | 643 | &edac_dev->kobj, "%s", instance->name); |
649 | if (err != 0) { | 644 | if (err != 0) { |
650 | debugf2("%s() Failed to register instance '%s'\n", | 645 | edac_dbg(2, "Failed to register instance '%s'\n", |
651 | __func__, instance->name); | 646 | instance->name); |
652 | kobject_put(main_kobj); | 647 | kobject_put(main_kobj); |
653 | goto err_out; | 648 | goto err_out; |
654 | } | 649 | } |
655 | 650 | ||
656 | debugf4("%s() now register '%d' blocks for instance %d\n", | 651 | edac_dbg(4, "now register '%d' blocks for instance %d\n", |
657 | __func__, instance->nr_blocks, idx); | 652 | instance->nr_blocks, idx); |
658 | 653 | ||
659 | /* register all blocks of this instance */ | 654 | /* register all blocks of this instance */ |
660 | for (i = 0; i < instance->nr_blocks; i++) { | 655 | for (i = 0; i < instance->nr_blocks; i++) { |
@@ -670,8 +665,8 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev, | |||
670 | } | 665 | } |
671 | kobject_uevent(&instance->kobj, KOBJ_ADD); | 666 | kobject_uevent(&instance->kobj, KOBJ_ADD); |
672 | 667 | ||
673 | debugf4("%s() Registered instance %d '%s' kobject\n", | 668 | edac_dbg(4, "Registered instance %d '%s' kobject\n", |
674 | __func__, idx, instance->name); | 669 | idx, instance->name); |
675 | 670 | ||
676 | return 0; | 671 | return 0; |
677 | 672 | ||
@@ -715,7 +710,7 @@ static int edac_device_create_instances(struct edac_device_ctl_info *edac_dev) | |||
715 | int i, j; | 710 | int i, j; |
716 | int err; | 711 | int err; |
717 | 712 | ||
718 | debugf0("%s()\n", __func__); | 713 | edac_dbg(0, "\n"); |
719 | 714 | ||
720 | /* iterate over creation of the instances */ | 715 | /* iterate over creation of the instances */ |
721 | for (i = 0; i < edac_dev->nr_instances; i++) { | 716 | for (i = 0; i < edac_dev->nr_instances; i++) { |
@@ -817,12 +812,12 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | |||
817 | int err; | 812 | int err; |
818 | struct kobject *edac_kobj = &edac_dev->kobj; | 813 | struct kobject *edac_kobj = &edac_dev->kobj; |
819 | 814 | ||
820 | debugf0("%s() idx=%d\n", __func__, edac_dev->dev_idx); | 815 | edac_dbg(0, "idx=%d\n", edac_dev->dev_idx); |
821 | 816 | ||
822 | /* go create any main attributes callers wants */ | 817 | /* go create any main attributes callers wants */ |
823 | err = edac_device_add_main_sysfs_attributes(edac_dev); | 818 | err = edac_device_add_main_sysfs_attributes(edac_dev); |
824 | if (err) { | 819 | if (err) { |
825 | debugf0("%s() failed to add sysfs attribs\n", __func__); | 820 | edac_dbg(0, "failed to add sysfs attribs\n"); |
826 | goto err_out; | 821 | goto err_out; |
827 | } | 822 | } |
828 | 823 | ||
@@ -832,8 +827,7 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | |||
832 | err = sysfs_create_link(edac_kobj, | 827 | err = sysfs_create_link(edac_kobj, |
833 | &edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK); | 828 | &edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK); |
834 | if (err) { | 829 | if (err) { |
835 | debugf0("%s() sysfs_create_link() returned err= %d\n", | 830 | edac_dbg(0, "sysfs_create_link() returned err= %d\n", err); |
836 | __func__, err); | ||
837 | goto err_remove_main_attribs; | 831 | goto err_remove_main_attribs; |
838 | } | 832 | } |
839 | 833 | ||
@@ -843,14 +837,13 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev) | |||
843 | */ | 837 | */ |
844 | err = edac_device_create_instances(edac_dev); | 838 | err = edac_device_create_instances(edac_dev); |
845 | if (err) { | 839 | if (err) { |
846 | debugf0("%s() edac_device_create_instances() " | 840 | edac_dbg(0, "edac_device_create_instances() returned err= %d\n", |
847 | "returned err= %d\n", __func__, err); | 841 | err); |
848 | goto err_remove_link; | 842 | goto err_remove_link; |
849 | } | 843 | } |
850 | 844 | ||
851 | 845 | ||
852 | debugf4("%s() create-instances done, idx=%d\n", | 846 | edac_dbg(4, "create-instances done, idx=%d\n", edac_dev->dev_idx); |
853 | __func__, edac_dev->dev_idx); | ||
854 | 847 | ||
855 | return 0; | 848 | return 0; |
856 | 849 | ||
@@ -873,7 +866,7 @@ err_out: | |||
873 | */ | 866 | */ |
874 | void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev) | 867 | void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev) |
875 | { | 868 | { |
876 | debugf0("%s()\n", __func__); | 869 | edac_dbg(0, "\n"); |
877 | 870 | ||
878 | /* remove any main attributes for this device */ | 871 | /* remove any main attributes for this device */ |
879 | edac_device_remove_main_sysfs_attributes(edac_dev); | 872 | edac_device_remove_main_sysfs_attributes(edac_dev); |