aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2010-03-30 14:31:29 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-21 12:37:31 -0400
commitf349cf34731c3b3eddbcd63cb04489aee2c405bd (patch)
tree2400790efc15c7f413ee62d79f47a5fdd4ba3233 /drivers/base
parent746edb7ae8a1abdd39be2b28c03aa073183340db (diff)
driver core: Implement ns directory support for device classes.
device_del and device_rename were modified to use sysfs_delete_link and sysfs_rename_link respectively to ensure when these operations happen on devices whose classes are in namespace directories they work properly. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Benjamin Thery <benjamin.thery@bull.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index f0699918e2f6..17e7d5048b83 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -786,7 +786,7 @@ out_device:
786out_busid: 786out_busid:
787 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 787 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
788 device_is_not_partition(dev)) 788 device_is_not_partition(dev))
789 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 789 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj,
790 dev_name(dev)); 790 dev_name(dev));
791#else 791#else
792 /* link in the class directory pointing to the device */ 792 /* link in the class directory pointing to the device */
@@ -804,7 +804,7 @@ out_busid:
804 return 0; 804 return 0;
805 805
806out_busid: 806out_busid:
807 sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev)); 807 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
808#endif 808#endif
809 809
810out_subsys: 810out_subsys:
@@ -832,13 +832,13 @@ static void device_remove_class_symlinks(struct device *dev)
832 832
833 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj && 833 if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
834 device_is_not_partition(dev)) 834 device_is_not_partition(dev))
835 sysfs_remove_link(&dev->class->p->class_subsys.kobj, 835 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj,
836 dev_name(dev)); 836 dev_name(dev));
837#else 837#else
838 if (dev->parent && device_is_not_partition(dev)) 838 if (dev->parent && device_is_not_partition(dev))
839 sysfs_remove_link(&dev->kobj, "device"); 839 sysfs_remove_link(&dev->kobj, "device");
840 840
841 sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev)); 841 sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
842#endif 842#endif
843 843
844 sysfs_remove_link(&dev->kobj, "subsystem"); 844 sysfs_remove_link(&dev->kobj, "subsystem");
@@ -1624,6 +1624,14 @@ int device_rename(struct device *dev, char *new_name)
1624 goto out; 1624 goto out;
1625 } 1625 }
1626 1626
1627#ifndef CONFIG_SYSFS_DEPRECATED
1628 if (dev->class) {
1629 error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
1630 &dev->kobj, old_device_name, new_name);
1631 if (error)
1632 goto out;
1633 }
1634#endif
1627 error = kobject_rename(&dev->kobj, new_name); 1635 error = kobject_rename(&dev->kobj, new_name);
1628 if (error) 1636 if (error)
1629 goto out; 1637 goto out;
@@ -1638,11 +1646,6 @@ int device_rename(struct device *dev, char *new_name)
1638 new_class_name); 1646 new_class_name);
1639 } 1647 }
1640 } 1648 }
1641#else
1642 if (dev->class) {
1643 error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
1644 &dev->kobj, old_device_name, new_name);
1645 }
1646#endif 1649#endif
1647 1650
1648out: 1651out: