Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
[platform/kernel/linux-starfive.git] / drivers / base / core.c
index f069991..9630fbd 100644 (file)
@@ -786,7 +786,7 @@ out_device:
 out_busid:
        if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
            device_is_not_partition(dev))
-               sysfs_remove_link(&dev->class->p->class_subsys.kobj,
+               sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj,
                                  dev_name(dev));
 #else
        /* link in the class directory pointing to the device */
@@ -804,7 +804,7 @@ out_busid:
        return 0;
 
 out_busid:
-       sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev));
+       sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
 #endif
 
 out_subsys:
@@ -832,13 +832,13 @@ static void device_remove_class_symlinks(struct device *dev)
 
        if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
            device_is_not_partition(dev))
-               sysfs_remove_link(&dev->class->p->class_subsys.kobj,
+               sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj,
                                  dev_name(dev));
 #else
        if (dev->parent && device_is_not_partition(dev))
                sysfs_remove_link(&dev->kobj, "device");
 
-       sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev));
+       sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
 #endif
 
        sysfs_remove_link(&dev->kobj, "subsystem");
@@ -1420,7 +1420,7 @@ struct device *__root_device_register(const char *name, struct module *owner)
                return ERR_PTR(err);
        }
 
-#ifdef CONFIG_MODULE   /* gotta find a "cleaner" way to do this */
+#ifdef CONFIG_MODULES  /* gotta find a "cleaner" way to do this */
        if (owner) {
                struct module_kobject *mk = &owner->mkobj;
 
@@ -1624,6 +1624,14 @@ int device_rename(struct device *dev, char *new_name)
                goto out;
        }
 
+#ifndef CONFIG_SYSFS_DEPRECATED
+       if (dev->class) {
+               error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
+                       &dev->kobj, old_device_name, new_name);
+               if (error)
+                       goto out;
+       }
+#endif
        error = kobject_rename(&dev->kobj, new_name);
        if (error)
                goto out;
@@ -1638,11 +1646,6 @@ int device_rename(struct device *dev, char *new_name)
                                                  new_class_name);
                }
        }
-#else
-       if (dev->class) {
-               error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
-                                         &dev->kobj, old_device_name, new_name);
-       }
 #endif
 
 out: