aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-12-18 01:05:35 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:30 -0500
commit9990513c1ef040528c4e38163a073089d39c7903 (patch)
treee170d5874a044f29b245714ae9c0ad3f3deac728
parent60728d62e4d273776e9ef9704f9ff8e8a248a8a1 (diff)
Kobject: convert drivers/base/core.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 <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/core.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b3a931fe6b16..beb351600675 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -523,8 +523,7 @@ static void klist_children_put(struct klist_node *n)
523void device_initialize(struct device *dev) 523void device_initialize(struct device *dev)
524{ 524{
525 dev->kobj.kset = devices_kset; 525 dev->kobj.kset = devices_kset;
526 dev->kobj.ktype = &device_ktype; 526 kobject_init_ng(&dev->kobj, &device_ktype);
527 kobject_init(&dev->kobj);
528 klist_init(&dev->klist_children, klist_children_get, 527 klist_init(&dev->klist_children, klist_children_get,
529 klist_children_put); 528 klist_children_put);
530 INIT_LIST_HEAD(&dev->dma_pools); 529 INIT_LIST_HEAD(&dev->dma_pools);
@@ -729,7 +728,7 @@ static void device_remove_class_symlinks(struct device *dev)
729 * This is part 2 of device_register(), though may be called 728 * This is part 2 of device_register(), though may be called
730 * separately _iff_ device_initialize() has been called separately. 729 * separately _iff_ device_initialize() has been called separately.
731 * 730 *
732 * This adds it to the kobject hierarchy via kobject_add(), adds it 731 * This adds it to the kobject hierarchy via kobject_add_ng(), adds it
733 * to the global and sibling lists for the device, then 732 * to the global and sibling lists for the device, then
734 * adds it to the other relevant subsystems of the driver model. 733 * adds it to the other relevant subsystems of the driver model.
735 */ 734 */
@@ -760,8 +759,7 @@ int device_add(struct device *dev)
760 goto Error; 759 goto Error;
761 760
762 /* first, register with generic layer. */ 761 /* first, register with generic layer. */
763 kobject_set_name(&dev->kobj, "%s", dev->bus_id); 762 error = kobject_add_ng(&dev->kobj, dev->kobj.parent, "%s", dev->bus_id);
764 error = kobject_add(&dev->kobj);
765 if (error) 763 if (error)
766 goto Error; 764 goto Error;
767 765