mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 09:31:14 +00:00
driver core: Allow device_move(dev, NULL).
If we allow NULL as the new parent in device_move(), we need to make sure that the device is placed into the same place as it would if it was newly registered: - Consider the device virtual tree. In order to be able to reuse code, setup_parent() has been tweaked a bit. - kobject_move() can fall back to the kset's kobject. - sysfs_move_dir() uses the sysfs root dir as fallback. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Cc: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
717e48c29d
commit
c744aeae9d
3 changed files with 52 additions and 36 deletions
|
@ -314,7 +314,7 @@ int kobject_rename(struct kobject * kobj, const char *new_name)
|
|||
/**
|
||||
* kobject_move - move object to another parent
|
||||
* @kobj: object in question.
|
||||
* @new_parent: object's new parent
|
||||
* @new_parent: object's new parent (can be NULL)
|
||||
*/
|
||||
|
||||
int kobject_move(struct kobject *kobj, struct kobject *new_parent)
|
||||
|
@ -330,8 +330,8 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
|
|||
return -EINVAL;
|
||||
new_parent = kobject_get(new_parent);
|
||||
if (!new_parent) {
|
||||
error = -EINVAL;
|
||||
goto out;
|
||||
if (kobj->kset)
|
||||
new_parent = kobject_get(&kobj->kset->kobj);
|
||||
}
|
||||
/* old object path */
|
||||
devpath = kobject_get_path(kobj, GFP_KERNEL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue