mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04: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 <[email protected]> Cc: Marcel Holtmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
717e48c29d
commit
c744aeae9d
3 changed files with 52 additions and 36 deletions
|
|
@ -378,12 +378,10 @@ int sysfs_move_dir(struct kobject *kobj, struct kobject *new_parent)
|
|||
struct sysfs_dirent *new_parent_sd, *sd;
|
||||
int error;
|
||||
|
||||
if (!new_parent)
|
||||
return -EINVAL;
|
||||
|
||||
old_parent_dentry = kobj->parent ?
|
||||
kobj->parent->dentry : sysfs_mount->mnt_sb->s_root;
|
||||
new_parent_dentry = new_parent->dentry;
|
||||
new_parent_dentry = new_parent ?
|
||||
new_parent->dentry : sysfs_mount->mnt_sb->s_root;
|
||||
|
||||
again:
|
||||
mutex_lock(&old_parent_dentry->d_inode->i_mutex);
|
||||
|
|
|
|||
Loading…
Reference in a new issue