Commit c5c3f275 authored by Patrick Mochel's avatar Patrick Mochel

[kobject] Don't specially order objects in lists based on parent.

Previously, we would insert kobjects into their kset's lists at different
locations based on if they had a parent or not - We kept an explicit 
depth-first list by placing devices directly before their parents.

However, we don't need strict ordering. Assuming that a subordinate device 
is always added after its parent (true), then by adding them to the end of 
the list, then subordinate objects will always be farther down the list than
their parent objects. We don't need to do anything special..
parent d4841357
...@@ -252,14 +252,15 @@ int kobject_add(struct kobject * kobj) ...@@ -252,14 +252,15 @@ int kobject_add(struct kobject * kobj)
if (kobj->kset) { if (kobj->kset) {
down_write(&kobj->kset->subsys->rwsem); down_write(&kobj->kset->subsys->rwsem);
if (parent)
list_add_tail(&kobj->entry,&parent->entry); if (!parent)
else { parent = kobject_get(&kobj->kset->kobj);
list_add_tail(&kobj->entry,&kobj->kset->list);
kobj->parent = kobject_get(&kobj->kset->kobj); list_add_tail(&kobj->entry,&kobj->kset->list);
}
up_write(&kobj->kset->subsys->rwsem); up_write(&kobj->kset->subsys->rwsem);
} }
kobj->parent = parent;
error = create_dir(kobj); error = create_dir(kobj);
if (error) if (error)
unlink(kobj); unlink(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