Commit e50ebaf5 authored by Patrick Mochel's avatar Patrick Mochel

driver model: Set device's kset before calling kobject_add().

Suggested by James Bottomley, and technically correct. We want the kset of
the kobjects to be set before we call kobject_add() so we can access the 
kset's release method when the object is deleted.
parent 71e2d1cd
...@@ -180,6 +180,7 @@ void device_remove_file(struct device * dev, struct device_attribute * attr) ...@@ -180,6 +180,7 @@ void device_remove_file(struct device * dev, struct device_attribute * attr)
void device_initialize(struct device *dev) void device_initialize(struct device *dev)
{ {
kobj_set_kset_s(dev,devices_subsys);
kobject_init(&dev->kobj); kobject_init(&dev->kobj);
INIT_LIST_HEAD(&dev->node); INIT_LIST_HEAD(&dev->node);
INIT_LIST_HEAD(&dev->children); INIT_LIST_HEAD(&dev->children);
...@@ -214,7 +215,6 @@ int device_add(struct device *dev) ...@@ -214,7 +215,6 @@ int device_add(struct device *dev)
/* first, register with generic layer. */ /* first, register with generic layer. */
strncpy(dev->kobj.name,dev->bus_id,KOBJ_NAME_LEN); strncpy(dev->kobj.name,dev->bus_id,KOBJ_NAME_LEN);
kobj_set_kset_s(dev,devices_subsys);
if (parent) if (parent)
dev->kobj.parent = &parent->kobj; dev->kobj.parent = &parent->kobj;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment