summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2007-01-08 20:16:44 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 10:37:11 -0800
commitc744aeae9d173a953b771a7ad5c872f91fa99dec (patch)
tree83d36e211ff6d0109f3aeb29d4fd1bb2dbb2a9b3 /fs
parent717e48c29d9a58f4d31c1651bec364212da5f6b2 (diff)
downloadlinux-c744aeae9d173a953b771a7ad5c872f91fa99dec.tar.bz2
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/sysfs/dir.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 511edef8b321..2bab1b4ddf5a 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -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);