Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=99ef3ef8d5f2f5b5312627127ad63df27c0d0d05
Commit:     99ef3ef8d5f2f5b5312627127ad63df27c0d0d05
Parent:     b9cafc7d5b8af0c71896f60dfcff40c71bd38a9a
Author:     Kay Sievers <[EMAIL PROTECTED]>
AuthorDate: Thu Sep 14 11:23:28 2006 +0200
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Dec 1 14:51:59 2006 -0800

    CONFIG_SYSFS_DEPRECATED - device symlinks
    
    Turn off device symlinks CONFIG_SYSFS_DEPRECATED is enabled.
    
    Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/base/core.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 8f8347b..b565b7e 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -513,11 +513,13 @@ int device_add(struct device *dev)
                if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
                        sysfs_create_link(&dev->class->subsys.kset.kobj,
                                          &dev->kobj, dev->bus_id);
+#ifdef CONFIG_SYSFS_DEPRECATED
                if (parent) {
                        sysfs_create_link(&dev->kobj, &dev->parent->kobj, 
"device");
                        class_name = make_class_name(dev->class->name, 
&dev->kobj);
                        sysfs_create_link(&dev->parent->kobj, &dev->kobj, 
class_name);
                }
+#endif
        }
 
        if ((error = device_add_attrs(dev)))
@@ -639,7 +641,6 @@ void put_device(struct device * dev)
 void device_del(struct device * dev)
 {
        struct device * parent = dev->parent;
-       char *class_name = NULL;
        struct class_interface *class_intf;
 
        if (parent)
@@ -655,12 +656,16 @@ void device_del(struct device * dev)
                if (dev->kobj.parent != &dev->class->subsys.kset.kobj)
                        sysfs_remove_link(&dev->class->subsys.kset.kobj,
                                          dev->bus_id);
-               class_name = make_class_name(dev->class->name, &dev->kobj);
+#ifdef CONFIG_SYSFS_DEPRECATED
                if (parent) {
-                       sysfs_remove_link(&dev->kobj, "device");
+                       char *class_name = make_class_name(dev->class->name,
+                                                          &dev->kobj);
                        sysfs_remove_link(&dev->parent->kobj, class_name);
+                       kfree(class_name);
+                       sysfs_remove_link(&dev->kobj, "device");
                }
-               kfree(class_name);
+#endif
+
                down(&dev->class->sem);
                /* notify any interfaces that the device is now gone */
                list_for_each_entry(class_intf, &dev->class->interfaces, node)
@@ -869,8 +874,10 @@ int device_rename(struct device *dev, ch
 
        pr_debug("DEVICE: renaming '%s' to '%s'\n", dev->bus_id, new_name);
 
+#ifdef CONFIG_SYSFS_DEPRECATED
        if ((dev->class) && (dev->parent))
                old_class_name = make_class_name(dev->class->name, &dev->kobj);
+#endif
 
        if (dev->class) {
                old_symlink_name = kmalloc(BUS_ID_SIZE, GFP_KERNEL);
@@ -885,6 +892,7 @@ int device_rename(struct device *dev, ch
 
        error = kobject_rename(&dev->kobj, new_name);
 
+#ifdef CONFIG_SYSFS_DEPRECATED
        if (old_class_name) {
                new_class_name = make_class_name(dev->class->name, &dev->kobj);
                if (new_class_name) {
@@ -893,6 +901,8 @@ int device_rename(struct device *dev, ch
                        sysfs_remove_link(&dev->parent->kobj, old_class_name);
                }
        }
+#endif
+
        if (dev->class) {
                sysfs_remove_link(&dev->class->subsys.kset.kobj,
                                  old_symlink_name);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to