aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_device_sysfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/edac/edac_device_sysfs.c')
-rw-r--r--drivers/edac/edac_device_sysfs.c71
1 files changed, 35 insertions, 36 deletions
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index b4ea185cceb..1cee83ec35f 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 debugf4("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 debugf1("\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 debugf1("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 debugf1("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,8 @@ 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 debugf4("Registered '.../edac/%s' kobject\n",
278 __func__, edac_dev->name); 278 edac_dev->name);
279 279
280 return 0; 280 return 0;
281 281
@@ -296,9 +296,9 @@ err_out:
296 */ 296 */
297void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev) 297void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev)
298{ 298{
299 debugf0("%s()\n", __func__); 299 debugf0("\n");
300 debugf4("%s() name of kobject is: %s\n", 300 debugf4("name of kobject is: %s\n",
301 __func__, kobject_name(&dev->kobj)); 301 kobject_name(&dev->kobj));
302 302
303 /* 303 /*
304 * Unregister the edac device's kobject and 304 * Unregister the edac device's kobject and
@@ -336,7 +336,7 @@ static void edac_device_ctrl_instance_release(struct kobject *kobj)
336{ 336{
337 struct edac_device_instance *instance; 337 struct edac_device_instance *instance;
338 338
339 debugf1("%s()\n", __func__); 339 debugf1("\n");
340 340
341 /* map from this kobj to the main control struct 341 /* map from this kobj to the main control struct
342 * and then dec the main kobj count 342 * and then dec the main kobj count
@@ -442,7 +442,7 @@ static void edac_device_ctrl_block_release(struct kobject *kobj)
442{ 442{
443 struct edac_device_block *block; 443 struct edac_device_block *block;
444 444
445 debugf1("%s()\n", __func__); 445 debugf1("\n");
446 446
447 /* get the container of the kobj */ 447 /* get the container of the kobj */
448 block = to_block(kobj); 448 block = to_block(kobj);
@@ -524,10 +524,10 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
524 struct edac_dev_sysfs_block_attribute *sysfs_attrib; 524 struct edac_dev_sysfs_block_attribute *sysfs_attrib;
525 struct kobject *main_kobj; 525 struct kobject *main_kobj;
526 526
527 debugf4("%s() Instance '%s' inst_p=%p block '%s' block_p=%p\n", 527 debugf4("Instance '%s' inst_p=%p block '%s' block_p=%p\n",
528 __func__, instance->name, instance, block->name, block); 528 instance->name, instance, block->name, block);
529 debugf4("%s() block kobj=%p block kobj->parent=%p\n", 529 debugf4("block kobj=%p block kobj->parent=%p\n",
530 __func__, &block->kobj, &block->kobj.parent); 530 &block->kobj, &block->kobj.parent);
531 531
532 /* init this block's kobject */ 532 /* init this block's kobject */
533 memset(&block->kobj, 0, sizeof(struct kobject)); 533 memset(&block->kobj, 0, sizeof(struct kobject));
@@ -546,8 +546,8 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
546 &instance->kobj, 546 &instance->kobj,
547 "%s", block->name); 547 "%s", block->name);
548 if (err) { 548 if (err) {
549 debugf1("%s() Failed to register instance '%s'\n", 549 debugf1("Failed to register instance '%s'\n",
550 __func__, block->name); 550 block->name);
551 kobject_put(main_kobj); 551 kobject_put(main_kobj);
552 err = -ENODEV; 552 err = -ENODEV;
553 goto err_out; 553 goto err_out;
@@ -560,9 +560,8 @@ static int edac_device_create_block(struct edac_device_ctl_info *edac_dev,
560 if (sysfs_attrib && block->nr_attribs) { 560 if (sysfs_attrib && block->nr_attribs) {
561 for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) { 561 for (i = 0; i < block->nr_attribs; i++, sysfs_attrib++) {
562 562
563 debugf4("%s() creating block attrib='%s' " 563 debugf4("creating block attrib='%s' "
564 "attrib->%p to kobj=%p\n", 564 "attrib->%p to kobj=%p\n",
565 __func__,
566 sysfs_attrib->attr.name, 565 sysfs_attrib->attr.name,
567 sysfs_attrib, &block->kobj); 566 sysfs_attrib, &block->kobj);
568 567
@@ -647,14 +646,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, 646 err = kobject_init_and_add(&instance->kobj, &ktype_instance_ctrl,
648 &edac_dev->kobj, "%s", instance->name); 647 &edac_dev->kobj, "%s", instance->name);
649 if (err != 0) { 648 if (err != 0) {
650 debugf2("%s() Failed to register instance '%s'\n", 649 debugf2("Failed to register instance '%s'\n",
651 __func__, instance->name); 650 instance->name);
652 kobject_put(main_kobj); 651 kobject_put(main_kobj);
653 goto err_out; 652 goto err_out;
654 } 653 }
655 654
656 debugf4("%s() now register '%d' blocks for instance %d\n", 655 debugf4("now register '%d' blocks for instance %d\n",
657 __func__, instance->nr_blocks, idx); 656 instance->nr_blocks, idx);
658 657
659 /* register all blocks of this instance */ 658 /* register all blocks of this instance */
660 for (i = 0; i < instance->nr_blocks; i++) { 659 for (i = 0; i < instance->nr_blocks; i++) {
@@ -670,8 +669,8 @@ static int edac_device_create_instance(struct edac_device_ctl_info *edac_dev,
670 } 669 }
671 kobject_uevent(&instance->kobj, KOBJ_ADD); 670 kobject_uevent(&instance->kobj, KOBJ_ADD);
672 671
673 debugf4("%s() Registered instance %d '%s' kobject\n", 672 debugf4("Registered instance %d '%s' kobject\n",
674 __func__, idx, instance->name); 673 idx, instance->name);
675 674
676 return 0; 675 return 0;
677 676
@@ -715,7 +714,7 @@ static int edac_device_create_instances(struct edac_device_ctl_info *edac_dev)
715 int i, j; 714 int i, j;
716 int err; 715 int err;
717 716
718 debugf0("%s()\n", __func__); 717 debugf0("\n");
719 718
720 /* iterate over creation of the instances */ 719 /* iterate over creation of the instances */
721 for (i = 0; i < edac_dev->nr_instances; i++) { 720 for (i = 0; i < edac_dev->nr_instances; i++) {
@@ -817,12 +816,12 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev)
817 int err; 816 int err;
818 struct kobject *edac_kobj = &edac_dev->kobj; 817 struct kobject *edac_kobj = &edac_dev->kobj;
819 818
820 debugf0("%s() idx=%d\n", __func__, edac_dev->dev_idx); 819 debugf0("idx=%d\n", edac_dev->dev_idx);
821 820
822 /* go create any main attributes callers wants */ 821 /* go create any main attributes callers wants */
823 err = edac_device_add_main_sysfs_attributes(edac_dev); 822 err = edac_device_add_main_sysfs_attributes(edac_dev);
824 if (err) { 823 if (err) {
825 debugf0("%s() failed to add sysfs attribs\n", __func__); 824 debugf0("failed to add sysfs attribs\n");
826 goto err_out; 825 goto err_out;
827 } 826 }
828 827
@@ -832,8 +831,8 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev)
832 err = sysfs_create_link(edac_kobj, 831 err = sysfs_create_link(edac_kobj,
833 &edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK); 832 &edac_dev->dev->kobj, EDAC_DEVICE_SYMLINK);
834 if (err) { 833 if (err) {
835 debugf0("%s() sysfs_create_link() returned err= %d\n", 834 debugf0("sysfs_create_link() returned err= %d\n",
836 __func__, err); 835 err);
837 goto err_remove_main_attribs; 836 goto err_remove_main_attribs;
838 } 837 }
839 838
@@ -843,14 +842,14 @@ int edac_device_create_sysfs(struct edac_device_ctl_info *edac_dev)
843 */ 842 */
844 err = edac_device_create_instances(edac_dev); 843 err = edac_device_create_instances(edac_dev);
845 if (err) { 844 if (err) {
846 debugf0("%s() edac_device_create_instances() " 845 debugf0("edac_device_create_instances() "
847 "returned err= %d\n", __func__, err); 846 "returned err= %d\n", err);
848 goto err_remove_link; 847 goto err_remove_link;
849 } 848 }
850 849
851 850
852 debugf4("%s() create-instances done, idx=%d\n", 851 debugf4("create-instances done, idx=%d\n",
853 __func__, edac_dev->dev_idx); 852 edac_dev->dev_idx);
854 853
855 return 0; 854 return 0;
856 855
@@ -873,7 +872,7 @@ err_out:
873 */ 872 */
874void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev) 873void edac_device_remove_sysfs(struct edac_device_ctl_info *edac_dev)
875{ 874{
876 debugf0("%s()\n", __func__); 875 debugf0("\n");
877 876
878 /* remove any main attributes for this device */ 877 /* remove any main attributes for this device */
879 edac_device_remove_main_sysfs_attributes(edac_dev); 878 edac_device_remove_main_sysfs_attributes(edac_dev);