Commit 2354dcc7 authored by Eric W. Biederman's avatar Eric W. Biederman Committed by Greg Kroah-Hartman

driver core: Use sysfs_rename_link in device_rename

Don't open code the renaming of symlinks in sysfs
instead use the new helper function sysfs_rename_link
Acked-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@aristanetworks.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 7cb32942
...@@ -1578,22 +1578,16 @@ int device_rename(struct device *dev, char *new_name) ...@@ -1578,22 +1578,16 @@ int device_rename(struct device *dev, char *new_name)
if (old_class_name) { if (old_class_name) {
new_class_name = make_class_name(dev->class->name, &dev->kobj); new_class_name = make_class_name(dev->class->name, &dev->kobj);
if (new_class_name) { if (new_class_name) {
error = sysfs_create_link_nowarn(&dev->parent->kobj, error = sysfs_rename_link(&dev->parent->kobj,
&dev->kobj, &dev->kobj,
new_class_name); old_class_name,
if (error) new_class_name);
goto out;
sysfs_remove_link(&dev->parent->kobj, old_class_name);
} }
} }
#else #else
if (dev->class) { if (dev->class) {
error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
&dev->kobj, dev_name(dev)); &dev->kobj, old_device_name, new_name);
if (error)
goto out;
sysfs_remove_link(&dev->class->p->class_subsys.kobj,
old_device_name);
} }
#endif #endif
......
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