aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/core.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b0d6646a2814..ef55df34ddd0 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1578,22 +1578,16 @@ int device_rename(struct device *dev, char *new_name)
1578 if (old_class_name) { 1578 if (old_class_name) {
1579 new_class_name = make_class_name(dev->class->name, &dev->kobj); 1579 new_class_name = make_class_name(dev->class->name, &dev->kobj);
1580 if (new_class_name) { 1580 if (new_class_name) {
1581 error = sysfs_create_link_nowarn(&dev->parent->kobj, 1581 error = sysfs_rename_link(&dev->parent->kobj,
1582 &dev->kobj, 1582 &dev->kobj,
1583 new_class_name); 1583 old_class_name,
1584 if (error) 1584 new_class_name);
1585 goto out;
1586 sysfs_remove_link(&dev->parent->kobj, old_class_name);
1587 } 1585 }
1588 } 1586 }
1589#else 1587#else
1590 if (dev->class) { 1588 if (dev->class) {
1591 error = sysfs_create_link_nowarn(&dev->class->p->class_subsys.kobj, 1589 error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
1592 &dev->kobj, dev_name(dev)); 1590 &dev->kobj, old_device_name, new_name);
1593 if (error)
1594 goto out;
1595 sysfs_remove_link(&dev->class->p->class_subsys.kobj,
1596 old_device_name);
1597 } 1591 }
1598#endif 1592#endif
1599 1593