aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_mc_sysfs.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-17 14:54:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:28 -0500
commitb2ed215a3338b8b16187be8d136153054118a41e (patch)
tree0abccda52f2c8356f35c857bcf2abbe7661b6e2d /drivers/edac/edac_mc_sysfs.c
parent038c5b3e412b0b751cb4b1507506bad3c7ffefae (diff)
Kobject: change drivers/edac to use kobject_init_and_add
Stop using kobject_register, as this way we can control the sending of the uevent properly, after everything is properly initialized. Acked-by: Doug Thompson <dougthompson@xmission.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/edac/edac_mc_sysfs.c')
-rw-r--r--drivers/edac/edac_mc_sysfs.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 905fcd73c26e..45b1d3633418 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -380,13 +380,6 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
380 /* generate ..../edac/mc/mc<id>/csrow<index> */ 380 /* generate ..../edac/mc/mc<id>/csrow<index> */
381 memset(&csrow->kobj, 0, sizeof(csrow->kobj)); 381 memset(&csrow->kobj, 0, sizeof(csrow->kobj));
382 csrow->mci = mci; /* include container up link */ 382 csrow->mci = mci; /* include container up link */
383 csrow->kobj.parent = kobj_mci;
384 csrow->kobj.ktype = &ktype_csrow;
385
386 /* name this instance of csrow<id> */
387 err = kobject_set_name(&csrow->kobj, "csrow%d", index);
388 if (err)
389 goto err_out;
390 383
391 /* bump the mci instance's kobject's ref count */ 384 /* bump the mci instance's kobject's ref count */
392 kobj = kobject_get(&mci->edac_mci_kobj); 385 kobj = kobject_get(&mci->edac_mci_kobj);
@@ -396,7 +389,8 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
396 } 389 }
397 390
398 /* Instanstiate the csrow object */ 391 /* Instanstiate the csrow object */
399 err = kobject_register(&csrow->kobj); 392 err = kobject_init_and_add(&csrow->kobj, &ktype_csrow, kobj_mci,
393 "csrow%d", index);
400 if (err) 394 if (err)
401 goto err_release_top_kobj; 395 goto err_release_top_kobj;
402 396
@@ -416,7 +410,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
416 goto err_out; 410 goto err_out;
417 } 411 }
418 } 412 }
419 413 kobject_uevent(&csrow->kobj, KOBJ_ADD);
420 return 0; 414 return 0;
421 415
422 /* error unwind stack */ 416 /* error unwind stack */
@@ -764,15 +758,6 @@ int edac_mc_register_sysfs_main_kobj(struct mem_ctl_info *mci)
764 /* Init the mci's kobject */ 758 /* Init the mci's kobject */
765 memset(kobj_mci, 0, sizeof(*kobj_mci)); 759 memset(kobj_mci, 0, sizeof(*kobj_mci));
766 760
767 /* this instance become part of the mc_kset */
768 kobj_mci->kset = &mc_kset;
769 kobj_mci->ktype = &ktype_mci;
770
771 /* set the name of the mc<id> object */
772 err = kobject_set_name(kobj_mci, "mc%d", mci->mc_idx);
773 if (err)
774 goto fail_out;
775
776 /* Record which module 'owns' this control structure 761 /* Record which module 'owns' this control structure
777 * and bump the ref count of the module 762 * and bump the ref count of the module
778 */ 763 */
@@ -784,13 +769,18 @@ int edac_mc_register_sysfs_main_kobj(struct mem_ctl_info *mci)
784 goto fail_out; 769 goto fail_out;
785 } 770 }
786 771
772 /* this instance become part of the mc_kset */
773 kobj_mci->kset = &mc_kset;
774
787 /* register the mc<id> kobject to the mc_kset */ 775 /* register the mc<id> kobject to the mc_kset */
788 err = kobject_register(kobj_mci); 776 err = kobject_init_and_add(kobj_mci, &ktype_mci, NULL,
777 "mc%d", mci->mc_idx);
789 if (err) { 778 if (err) {
790 debugf1("%s()Failed to register '.../edac/mc%d'\n", 779 debugf1("%s()Failed to register '.../edac/mc%d'\n",
791 __func__, mci->mc_idx); 780 __func__, mci->mc_idx);
792 goto kobj_reg_fail; 781 goto kobj_reg_fail;
793 } 782 }
783 kobject_uevent(kobj_mci, KOBJ_ADD);
794 784
795 /* At this point, to 'free' the control struct, 785 /* At this point, to 'free' the control struct,
796 * edac_mc_unregister_sysfs_main_kobj() must be used 786 * edac_mc_unregister_sysfs_main_kobj() must be used