aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/class.c')
-rw-r--r--drivers/base/class.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 3ffcda753e78..ba6745b0fd2f 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -546,8 +546,7 @@ static struct class_device_attribute class_uevent_attr =
546void class_device_initialize(struct class_device *class_dev) 546void class_device_initialize(struct class_device *class_dev)
547{ 547{
548 class_dev->kobj.kset = &class_obj_subsys; 548 class_dev->kobj.kset = &class_obj_subsys;
549 class_dev->kobj.ktype = &class_device_ktype; 549 kobject_init_ng(&class_dev->kobj, &class_device_ktype);
550 kobject_init(&class_dev->kobj);
551 INIT_LIST_HEAD(&class_dev->node); 550 INIT_LIST_HEAD(&class_dev->node);
552} 551}
553 552
@@ -575,16 +574,13 @@ int class_device_add(struct class_device *class_dev)
575 class_dev->class_id); 574 class_dev->class_id);
576 575
577 /* first, register with generic layer. */ 576 /* first, register with generic layer. */
578 error = kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id);
579 if (error)
580 goto out2;
581
582 if (parent_class_dev) 577 if (parent_class_dev)
583 class_dev->kobj.parent = &parent_class_dev->kobj; 578 class_dev->kobj.parent = &parent_class_dev->kobj;
584 else 579 else
585 class_dev->kobj.parent = &parent_class->subsys.kobj; 580 class_dev->kobj.parent = &parent_class->subsys.kobj;
586 581
587 error = kobject_add(&class_dev->kobj); 582 error = kobject_add_ng(&class_dev->kobj, class_dev->kobj.parent,
583 "%s", class_dev->class_id);
588 if (error) 584 if (error)
589 goto out2; 585 goto out2;
590 586