From: Greg Kroah-Hartman Date: Tue, 18 Dec 2007 06:05:35 +0000 (-0700) Subject: Kobject: convert drivers/base/class.c to use kobject_init/add_ng() X-Git-Tag: v2.6.25-rc1~1243^2~67 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=60728d62e4d273776e9ef9704f9ff8e8a248a8a1;p=linux-2.6-omap-h63xx.git Kobject: convert drivers/base/class.c to use kobject_init/add_ng() This converts the code to use the new kobject functions, cleaning up the logic in doing so. Cc: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/base/class.c b/drivers/base/class.c index 3ffcda753e7..ba6745b0fd2 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -546,8 +546,7 @@ static struct class_device_attribute class_uevent_attr = void class_device_initialize(struct class_device *class_dev) { class_dev->kobj.kset = &class_obj_subsys; - class_dev->kobj.ktype = &class_device_ktype; - kobject_init(&class_dev->kobj); + kobject_init_ng(&class_dev->kobj, &class_device_ktype); INIT_LIST_HEAD(&class_dev->node); } @@ -575,16 +574,13 @@ int class_device_add(struct class_device *class_dev) class_dev->class_id); /* first, register with generic layer. */ - error = kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id); - if (error) - goto out2; - if (parent_class_dev) class_dev->kobj.parent = &parent_class_dev->kobj; else class_dev->kobj.parent = &parent_class->subsys.kobj; - error = kobject_add(&class_dev->kobj); + error = kobject_add_ng(&class_dev->kobj, class_dev->kobj.parent, + "%s", class_dev->class_id); if (error) goto out2;