aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2006-09-14 05:23:28 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:51:59 -0500
commit99ef3ef8d5f2f5b5312627127ad63df27c0d0d05 (patch)
tree28fd0a0f84fd280bfa7cbcbca68b2818af003ee9 /drivers
parentb9cafc7d5b8af0c71896f60dfcff40c71bd38a9a (diff)
CONFIG_SYSFS_DEPRECATED - device symlinks
Turn off device symlinks CONFIG_SYSFS_DEPRECATED is enabled. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/core.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8f8347b9197f..b565b7e9d40b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -513,11 +513,13 @@ int device_add(struct device *dev)
513 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 513 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
514 sysfs_create_link(&dev->class->subsys.kset.kobj, 514 sysfs_create_link(&dev->class->subsys.kset.kobj,
515 &dev->kobj, dev->bus_id); 515 &dev->kobj, dev->bus_id);
516#ifdef CONFIG_SYSFS_DEPRECATED
516 if (parent) { 517 if (parent) {
517 sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device"); 518 sysfs_create_link(&dev->kobj, &dev->parent->kobj, "device");
518 class_name = make_class_name(dev->class->name, &dev->kobj); 519 class_name = make_class_name(dev->class->name, &dev->kobj);
519 sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name); 520 sysfs_create_link(&dev->parent->kobj, &dev->kobj, class_name);
520 } 521 }
522#endif
521 } 523 }
522 524
523 if ((error = device_add_attrs(dev))) 525 if ((error = device_add_attrs(dev)))
@@ -639,7 +641,6 @@ void put_device(struct device * dev)
639void device_del(struct device * dev) 641void device_del(struct device * dev)
640{ 642{
641 struct device * parent = dev->parent; 643 struct device * parent = dev->parent;
642 char *class_name = NULL;
643 struct class_interface *class_intf; 644 struct class_interface *class_intf;
644 645
645 if (parent) 646 if (parent)
@@ -655,12 +656,16 @@ void device_del(struct device * dev)
655 if (dev->kobj.parent != &dev->class->subsys.kset.kobj) 656 if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
656 sysfs_remove_link(&dev->class->subsys.kset.kobj, 657 sysfs_remove_link(&dev->class->subsys.kset.kobj,
657 dev->bus_id); 658 dev->bus_id);
658 class_name = make_class_name(dev->class->name, &dev->kobj); 659#ifdef CONFIG_SYSFS_DEPRECATED
659 if (parent) { 660 if (parent) {
660 sysfs_remove_link(&dev->kobj, "device"); 661 char *class_name = make_class_name(dev->class->name,
662 &dev->kobj);
661 sysfs_remove_link(&dev->parent->kobj, class_name); 663 sysfs_remove_link(&dev->parent->kobj, class_name);
664 kfree(class_name);
665 sysfs_remove_link(&dev->kobj, "device");
662 } 666 }
663 kfree(class_name); 667#endif
668
664 down(&dev->class->sem); 669 down(&dev->class->sem);
665 /* notify any interfaces that the device is now gone */ 670 /* notify any interfaces that the device is now gone */
666 list_for_each_entry(class_intf, &dev->class->interfaces, node) 671 list_for_each_entry(class_intf, &dev->class->interfaces, node)
@@ -869,8 +874,10 @@ int device_rename(struct device *dev, char *new_name)
869 874
870 pr_debug("DEVICE: renaming '%s' to '%s'\n", dev->bus_id, new_name); 875 pr_debug("DEVICE: renaming '%s' to '%s'\n", dev->bus_id, new_name);
871 876
877#ifdef CONFIG_SYSFS_DEPRECATED
872 if ((dev->class) && (dev->parent)) 878 if ((dev->class) && (dev->parent))
873 old_class_name = make_class_name(dev->class->name, &dev->kobj); 879 old_class_name = make_class_name(dev->class->name, &dev->kobj);
880#endif
874 881
875 if (dev->class) { 882 if (dev->class) {
876 old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL); 883 old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL);
@@ -885,6 +892,7 @@ int device_rename(struct device *dev, char *new_name)
885 892
886 error = kobject_rename(&dev->kobj, new_name); 893 error = kobject_rename(&dev->kobj, new_name);
887 894
895#ifdef CONFIG_SYSFS_DEPRECATED
888 if (old_class_name) { 896 if (old_class_name) {
889 new_class_name = make_class_name(dev->class->name, &dev->kobj); 897 new_class_name = make_class_name(dev->class->name, &dev->kobj);
890 if (new_class_name) { 898 if (new_class_name) {
@@ -893,6 +901,8 @@ int device_rename(struct device *dev, char *new_name)
893 sysfs_remove_link(&dev->parent->kobj, old_class_name); 901 sysfs_remove_link(&dev->parent->kobj, old_class_name);
894 } 902 }
895 } 903 }
904#endif
905
896 if (dev->class) { 906 if (dev->class) {
897 sysfs_remove_link(&dev->class->subsys.kset.kobj, 907 sysfs_remove_link(&dev->class->subsys.kset.kobj,
898 old_symlink_name); 908 old_symlink_name);